]> xenbits.xensource.com Git - people/andrewcoop/hwloc.git/commitdiff
linux: fix a undefined warning about hwloc_linu...
authorBrice Goglin <brice.goglin@inria.fr>
Tue, 3 Sep 2013 20:08:30 +0000 (20:08 +0000)
committerBrice Goglin <brice.goglin@inria.fr>
Tue, 3 Sep 2013 20:08:30 +0000 (20:08 +0000)
linux: fix a undefined warning about hwloc_linux_parse_cpuset_file()

Move it in the same #ifdef as its only caller.

This commit was SVN r5786.

src/topology-linux.c

index 943ad253ec26560ee42594bec5a39b5aa9fca4f1..73965819a93e835856e4cb8a3353a02e3f15a152 100644 (file)
@@ -283,48 +283,6 @@ hwloc_opendir(const char *p, int d __hwloc_attribute_unused)
 }
 
 
-static int
-hwloc_linux_parse_cpuset_file(FILE *file, hwloc_bitmap_t set)
-{
-  unsigned long start, stop;
-
-  /* reset to zero first */
-  hwloc_bitmap_zero(set);
-
-  while (fscanf(file, "%lu", &start) == 1)
-  {
-    int c = fgetc(file);
-
-    stop = start;
-
-    if (c == '-') {
-      /* Range */
-      if (fscanf(file, "%lu", &stop) != 1) {
-        /* Expected a number here */
-        errno = EINVAL;
-        return -1;
-      }
-      c = fgetc(file);
-    }
-
-    if (c == EOF || c == '\n') {
-      hwloc_bitmap_set_range(set, start, stop);
-      break;
-    }
-
-    if (c != ',') {
-      /* Expected EOF, EOL, or a comma */
-      errno = EINVAL;
-      return -1;
-    }
-
-    hwloc_bitmap_set_range(set, start, stop);
-  }
-
-  return 0;
-}
-
-
 /*****************************
  ******* CpuBind Hooks *******
  *****************************/
@@ -394,6 +352,47 @@ hwloc_linux_set_tid_cpubind(hwloc_topology_t topology __hwloc_attribute_unused,
 }
 
 #if defined(HWLOC_HAVE_CPU_SET_S) && !defined(HWLOC_HAVE_OLD_SCHED_SETAFFINITY)
+static int
+hwloc_linux_parse_cpuset_file(FILE *file, hwloc_bitmap_t set)
+{
+  unsigned long start, stop;
+
+  /* reset to zero first */
+  hwloc_bitmap_zero(set);
+
+  while (fscanf(file, "%lu", &start) == 1)
+  {
+    int c = fgetc(file);
+
+    stop = start;
+
+    if (c == '-') {
+      /* Range */
+      if (fscanf(file, "%lu", &stop) != 1) {
+        /* Expected a number here */
+        errno = EINVAL;
+        return -1;
+      }
+      c = fgetc(file);
+    }
+
+    if (c == EOF || c == '\n') {
+      hwloc_bitmap_set_range(set, start, stop);
+      break;
+    }
+
+    if (c != ',') {
+      /* Expected EOF, EOL, or a comma */
+      errno = EINVAL;
+      return -1;
+    }
+
+    hwloc_bitmap_set_range(set, start, stop);
+  }
+
+  return 0;
+}
+
 /*
  * On some kernels, sched_getaffinity requires the output size to be larger
  * than the kernel cpu_set size (defined by CONFIG_NR_CPUS).