httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r721956 - in /httpd/httpd/trunk/modules/cluster: mod_heartbeat.c mod_heartmonitor.c
Date Mon, 01 Dec 2008 03:10:50 GMT
Author: pquerna
Date: Sun Nov 30 19:10:49 2008
New Revision: 721956

URL: http://svn.apache.org/viewvc?rev=721956&view=rev
Log:
Move variable declartions to the top of functions for c89'ness.

Modified:
    httpd/httpd/trunk/modules/cluster/mod_heartbeat.c
    httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c

Modified: httpd/httpd/trunk/modules/cluster/mod_heartbeat.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartbeat.c?rev=721956&r1=721955&r2=721956&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cluster/mod_heartbeat.c (original)
+++ httpd/httpd/trunk/modules/cluster/mod_heartbeat.c Sun Nov 30 19:10:49 2008
@@ -49,6 +49,9 @@
 
 static int hb_monitor(hb_ctx_t *ctx, apr_pool_t *p)
 {
+    apr_size_t len;
+    apr_socket_t *sock = NULL;
+    char buf[256];
     int i, j;
     apr_uint32_t ready = 0;
     apr_uint32_t busy = 0;
@@ -74,11 +77,8 @@
         }
     }
 
-    char buf[256];
-    apr_size_t len =
-        apr_snprintf(buf, sizeof(buf), msg_format, MSG_VERSION, ready, busy);
+    len = apr_snprintf(buf, sizeof(buf), msg_format, MSG_VERSION, ready, busy);
 
-    apr_socket_t *sock = NULL;
     do {
         apr_status_t rv;
         rv = apr_socket_create(&sock, ctx->mcast_addr->family,
@@ -136,6 +136,8 @@
 
     while (ctx->keep_running) {
         int mpm_state = 0;
+        apr_pool_t *tpool;
+
         rv = ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state);
 
         if (rv != APR_SUCCESS) {
@@ -147,7 +149,6 @@
             break;
         }
 
-        apr_pool_t *tpool;
         apr_pool_create(&tpool, pool);
         apr_pool_tag(tpool, "heartbeat_worker_temp");
         hb_monitor(ctx, tpool);
@@ -276,6 +277,8 @@
                                   void *dconf, const char *addr)
 {
     apr_status_t rv;
+    const char *tmpdir = NULL;
+    char *path;
     char *host_str;
     char *scope_id;
     apr_port_t port = 0;
@@ -312,13 +315,12 @@
         return "HeartbeatAddress: apr_sockaddr_info_get failed.";
     }
 
-    const char *tmpdir = NULL;
     rv = apr_temp_dir_get(&tmpdir, p);
     if (rv) {
         return "HeartbeatAddress: unable to find temp directory.";
     }
 
-    char *path = apr_pstrcat(p, tmpdir, "/hb-tmp.XXXXXX", NULL);
+    path = apr_pstrcat(p, tmpdir, "/hb-tmp.XXXXXX", NULL);
 
     rv = apr_file_mktemp(&ctx->lockf, path, 0, p);
 

Modified: httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c?rev=721956&r1=721955&r2=721956&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c (original)
+++ httpd/httpd/trunk/modules/cluster/mod_heartmonitor.c Sun Nov 30 19:10:49 2008
@@ -279,6 +279,7 @@
 
 static void *hm_worker(apr_thread_t *thd, void *data)
 {
+    apr_time_t last;
     hm_ctx_t *ctx = (hm_ctx_t *) data;
     apr_status_t rv;
 
@@ -307,15 +308,16 @@
     }
 
 
-    apr_time_t last = apr_time_now();
+    last = apr_time_now();
     while (ctx->keep_running) {
         int n;
         apr_pool_t *p;
         apr_pollfd_t pfd;
         apr_interval_time_t timeout;
+        apr_time_t now;
         apr_pool_create(&p, ctx->p);
 
-        apr_time_t now = apr_time_now();
+        now = apr_time_now();
 
         if (apr_time_sec((now - last)) > 5) {
             hm_update_stats(ctx, p);



Mime
View raw message