]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Correct small errors: Thanks Ruediger Pluem who review the code.
authorJean-Frederic Clere <jfclere@apache.org>
Thu, 20 Jul 2006 20:49:56 +0000 (20:49 +0000)
committerJean-Frederic Clere <jfclere@apache.org>
Thu, 20 Jul 2006 20:49:56 +0000 (20:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard@424059 13f79535-47bb-0310-9956-ffa450edef68

modules/mem/mod_plainmem.c
modules/mem/mod_scoreboard.c
modules/mem/mod_sharedmem.c

index 43dacfe10c055edb7329074f0459879204728296..77110c50a81cd5df38816a7971d3f8159f9321f0 100644 (file)
@@ -73,7 +73,7 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
                 *new = next;
                 return APR_SUCCESS;
             }
-            if (next->next)
+            if (!next->next)
                 break;
             next = next->next;
         }
@@ -84,7 +84,6 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
     res->base =  apr_pcalloc(globalpool, item_size * item_num);
     if (!res->base)
         return APR_ENOSHMAVAIL;
-    memset(res->base, 0, item_size * item_num);
 
     /* For the chained slotmem stuff */
     res->name = apr_pstrdup(globalpool, fname);
@@ -102,13 +101,14 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
 static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
 {
 
-    void *ptr = score->base + score->size * id;
+    void *ptr;
 
     if (!score)
         return APR_ENOSHMAVAIL;
     if (id<0 || id>score->num)
         return APR_ENOSHMAVAIL;
 
+    ptr = score->base + score->size * id;
     if (!ptr)
         return APR_ENOSHMAVAIL;
     *mem = ptr;
index e2d75df769da39429621cbb856b7eb62eb3bf212..231504ee34991f803a8e8fe603335da1d5e4ccab 100644 (file)
@@ -82,9 +82,6 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
     res->size = item_size;
     res->num = item_num;
     *new = res;
-    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
-                "ap_slotmem_create: score %d", score);
-
     return APR_SUCCESS;
 }
 static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
@@ -103,8 +100,6 @@ static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
     if (!ptr)
         return APR_ENOSHMAVAIL;
     *mem = ptr;
-    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
-                "ap_slotmem_mem: score %d", score);
     return APR_SUCCESS;
 }
 
index 20614a35718acd51ad4a92a44dc6668dc9a1f830..98b2add9c535b5ec609dda8d53477afc1d760ac4 100644 (file)
@@ -90,7 +90,7 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
                 *new = next;
                 return APR_SUCCESS;
             }
-            if (next->next)
+            if (!next->next)
                 break;
             next = next->next;
         }
@@ -130,15 +130,14 @@ static apr_status_t ap_slotmem_create(ap_slotmem_t **new, const char *name, apr_
 static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
 {
 
-    void *ptr = score->base + score->size * id;
+    void *ptr;
 
     if (!score)
         return APR_ENOSHMAVAIL;
     if (id<0 || id>score->num)
         return APR_ENOSHMAVAIL;
-    if (apr_shm_size_get(score->shm) != score->size * score->num)
-        return APR_ENOSHMAVAIL;
 
+    ptr = score->base + score->size * id;
     if (!ptr)
         return APR_ENOSHMAVAIL;
     *mem = ptr;
@@ -154,10 +153,6 @@ static const slotmem_storage_method storage = {
 /* make sure the shared memory is cleaned */
 static int initialize_cleanup(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 {
-    ap_slotmem_t *next = globallistmem;
-    while (next) {
-        next = next->next;
-    }
     apr_pool_cleanup_register(p, &globallistmem, cleanup_slotmem, apr_pool_cleanup_null);
     return OK;
 }