summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Frederic Clere <jfclere@apache.org>2006-07-20 20:49:56 +0000
committerJean-Frederic Clere <jfclere@apache.org>2006-07-20 20:49:56 +0000
commitcd80ecf805e4856cdb6c0ad199bd97bf3f91f7ba (patch)
tree8365be35bb00fadf196814a5df278046d2c86bc3
parent1005eae32ff7850ba91b7394543e210e22b1299e (diff)
downloadhttpd-cd80ecf805e4856cdb6c0ad199bd97bf3f91f7ba.tar.gz
Correct small errors: Thanks Ruediger Pluem who review the code.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpd-proxy-scoreboard@424059 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/mem/mod_plainmem.c6
-rw-r--r--modules/mem/mod_scoreboard.c5
-rw-r--r--modules/mem/mod_sharedmem.c11
3 files changed, 6 insertions, 16 deletions
diff --git a/modules/mem/mod_plainmem.c b/modules/mem/mod_plainmem.c
index 43dacfe10c..77110c50a8 100644
--- a/modules/mem/mod_plainmem.c
+++ b/modules/mem/mod_plainmem.c
@@ -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;
diff --git a/modules/mem/mod_scoreboard.c b/modules/mem/mod_scoreboard.c
index e2d75df769..231504ee34 100644
--- a/modules/mem/mod_scoreboard.c
+++ b/modules/mem/mod_scoreboard.c
@@ -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;
}
diff --git a/modules/mem/mod_sharedmem.c b/modules/mem/mod_sharedmem.c
index 20614a3571..98b2add9c5 100644
--- a/modules/mem/mod_sharedmem.c
+++ b/modules/mem/mod_sharedmem.c
@@ -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;
}