]> granicus.if.org Git - apache/commitdiff
wrap var inits in the macro w/ a do-while.
authorJim Jagielski <jim@apache.org>
Wed, 26 Sep 2012 15:28:27 +0000 (15:28 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 26 Sep 2012 15:28:27 +0000 (15:28 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1390564 13f79535-47bb-0310-9956-ffa450edef68

server/util.c

index 07a612403dd7859a5358d2773e9c5d804925f9d8..27ebfc141ed32496b2e93bb10397329f4f3feed5 100644 (file)
@@ -2838,24 +2838,26 @@ AP_DECLARE(void) ap_get_sload(ap_sload_t *ld)
 
 AP_DECLARE(void) ap_get_loadavg(ap_loadavg_t *ld)
 {
-    double la[3];
-    int num;
-
     /* preload errored fields, we overwrite */
     ld->loadavg = -1.0;
     ld->loadavg5 = -1.0;
     ld->loadavg15 = -1.0;
 
 #if HAVE_GETLOADAVG
-    num = getloadavg(la, 3);
-    if (num > 0) {
-        ld->loadavg = (float)la[0];
-    }
-    if (num > 1) {
-        ld->loadavg5 = (float)la[1];
-    }
-    if (num > 2) {
-        ld->loadavg15 = (float)la[2];
-    }
+    do {
+        double la[3];
+        int num;
+
+        num = getloadavg(la, 3);
+        if (num > 0) {
+            ld->loadavg = (float)la[0];
+        }
+        if (num > 1) {
+            ld->loadavg5 = (float)la[1];
+        }
+        if (num > 2) {
+            ld->loadavg15 = (float)la[2];
+        }
+    } while(0);
 #endif
 }