httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r574931 - /httpd/httpd/trunk/server/scoreboard.c
Date Wed, 12 Sep 2007 12:52:21 GMT
Author: jim
Date: Wed Sep 12 05:52:20 2007
New Revision: 574931

URL: http://svn.apache.org/viewvc?rev=574931&view=rev
Log:
Some minor cleanups:

  1. Rename worker_size, since this could easily be
     confused with the actual MPM worker struct stuff.
  2. Remove superflous ()s in the || test
  3. Add superflous () in the pointer adjusting :)
     Even though C prec rules make it clear what we
     are doing, make it painfully obvious. Remove
     unrequired temp var.

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

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=574931&r1=574930&r2=574931&view=diff
==============================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Wed Sep 12 05:52:20 2007
@@ -70,7 +70,7 @@
     int thread_num;
 };
 
-static int server_limit, thread_limit, lb_limit, worker_size;
+static int server_limit, thread_limit, lb_limit, lb_size;
 static apr_size_t scoreboard_size;
 
 /*
@@ -106,15 +106,15 @@
     if (!pfn_proxy_lb_worker_size)
         pfn_proxy_lb_worker_size = APR_RETRIEVE_OPTIONAL_FN(ap_proxy_lb_worker_size);
     if (pfn_proxy_lb_worker_size)
-        worker_size = pfn_proxy_lb_worker_size();
+        lb_size = pfn_proxy_lb_worker_size();
     else
-        worker_size = sizeof(lb_score);
+        lb_size = sizeof(lb_score);
 
     scoreboard_size = sizeof(global_score);
     scoreboard_size += sizeof(process_score) * server_limit;
     scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
-    if (lb_limit && worker_size)
-        scoreboard_size += worker_size * lb_limit;
+    if (lb_limit && lb_size)
+        scoreboard_size += lb_size * lb_limit;
 
     return scoreboard_size;
 }
@@ -138,9 +138,9 @@
         ap_scoreboard_image->servers[i] = (worker_score *)more_storage;
         more_storage += thread_limit * sizeof(worker_score);
     }
-    if (lb_limit && worker_size) {
+    if (lb_limit && lb_size) {
         ap_scoreboard_image->balancers = (void *)more_storage;
-        more_storage += lb_limit * worker_size;
+        more_storage += lb_limit * lb_size;
     }
     ap_assert(more_storage == (char*)shared_score + scoreboard_size);
     ap_scoreboard_image->global->server_limit = server_limit;
@@ -290,9 +290,9 @@
                    sizeof(worker_score) * thread_limit);
         }
         /* Clean up the lb workers data */
-        if (lb_limit && worker_size) {
+        if (lb_limit && lb_size) {
             memset(ap_scoreboard_image->balancers, 0,
-                   worker_size * lb_limit);
+                   lb_size * lb_limit);
         }
         return OK;
     }
@@ -499,10 +499,9 @@
 
 AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
 {
-    char *ptr;
-    if (((lb_num < 0) || (lb_limit < lb_num)) || (worker_size==0)) {
+    if ( (lb_num < 0) || (lb_limit < lb_num) || (lb_size==0) ) {
         return(NULL); /* Out of range */
     }
-    ptr = (char *) ap_scoreboard_image->balancers + lb_num*worker_size;
-    return (lb_score *) ptr;
+    return (lb_score *) ( ((char *) ap_scoreboard_image->balancers) +
+                          (lb_num*lb_size) );
 }



Mime
View raw message