httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1390564 - /httpd/httpd/trunk/server/util.c
Date Wed, 26 Sep 2012 15:28:27 GMT
Author: jim
Date: Wed Sep 26 15:28:27 2012
New Revision: 1390564

URL: http://svn.apache.org/viewvc?rev=1390564&view=rev
Log:
wrap var inits in the macro w/ a do-while.

Modified:
    httpd/httpd/trunk/server/util.c

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1390564&r1=1390563&r2=1390564&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Wed Sep 26 15:28:27 2012
@@ -2838,24 +2838,26 @@ AP_DECLARE(void) ap_get_sload(ap_sload_t
 
 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
 }



Mime
View raw message