]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Whitespace
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 16 Sep 2021 14:06:02 +0000 (09:06 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 16 Sep 2021 14:06:02 +0000 (09:06 -0500)
src/lib/util/hw.c

index 3fe36e780f4964e18eb4ea302d671504fb951e7a..6534223ce6bb1caf69c5bec0e127eb2aab1b43b1 100644 (file)
@@ -71,30 +71,31 @@ uint32_t fr_hw_num_cores_active(void)
 {
        uint32_t lcores = 0, tsibs = 0;
 
-        char buff[32];
-        char path[64];
+       char buff[32];
+       char path[64];
 
-        for (lcores = 0;;lcores++) {
-                FILE *cpu;
+       for (lcores = 0;;lcores++) {
+               FILE *cpu;
 
-                snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%u/topology/thread_siblings_list", lcores);
+               snprintf(path, sizeof(path), "/sys/devices/system/cpu/cpu%u/topology/thread_siblings_list", lcores);
 
-                cpu = fopen(path, "r");
-                if (!cpu) break;
+               cpu = fopen(path, "r");
+               if (!cpu) break;
 
-                while (fscanf(cpu, "%[0-9]", buff)) {
-                        tsibs++;
-                        if (fgetc(cpu) != ',') break;
-                }
+               while (fscanf(cpu, "%[0-9]", buff)) {
+                       tsibs++;
+                       if (fgetc(cpu) != ',') break;
+               }
+
+               fclose(cpu);
+       }
 
-                fclose(cpu);
-        }
+       if (!tsibs || !lcores) return 1;
 
        /*
         *      Prevent clang scanner from warning about divide by zero
         */
-       tsibs = tsibs / (lcores ? lcores : 1);
-       return lcores / (tsibs ? tsibs : 1);
+       return lcores / (tsibs / lcores);
 }
 #else
 size_t fr_hw_cache_line_size(void)