summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2014-07-16 17:38:03 +0000
committerYann Ylavic <ylavic@apache.org>2014-07-16 17:38:03 +0000
commitddf808f3e61837418d77df5a726b3a24008b3837 (patch)
tree003d532e29e1e796473d06c1a4fe45bff8897cd7 /tables
parent0dbe50a8436d856b724b1d1b2ce9db121828c7d6 (diff)
downloadapr-ddf808f3e61837418d77df5a726b3a24008b3837.tar.gz
We do not garantee zero-ed memory for apr_skiplist_alloc(), neither in
the description, nor in the code for reused chunks. So always allocate raw memory and don't rely on zero-ed one after internal calls to apr_skiplist_alloc(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1611107 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r--tables/apr_skiplist.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/tables/apr_skiplist.c b/tables/apr_skiplist.c
index 42ef396c2..7fca4a42a 100644
--- a/tables/apr_skiplist.c
+++ b/tables/apr_skiplist.c
@@ -52,10 +52,6 @@ struct apr_skiplistnode {
apr_skiplist *sl;
};
-#ifndef MIN
-#define MIN(a,b) ((a<b)?(a):(b))
-#endif
-
static int get_b_rand(void)
{
static int ph = 32; /* More bits than we will ever use */
@@ -103,7 +99,7 @@ APR_DECLARE(void *) apr_skiplist_alloc(apr_skiplist *sl, size_t size)
memlist++;
}
/* no free chunks */
- ptr = apr_pcalloc(sl->pool, size);
+ ptr = apr_palloc(sl->pool, size);
if (!ptr) {
return ptr;
}
@@ -122,7 +118,7 @@ APR_DECLARE(void *) apr_skiplist_alloc(apr_skiplist *sl, size_t size)
return ptr;
}
else {
- return calloc(1, size);
+ return malloc(size);
}
}
@@ -348,15 +344,13 @@ static apr_skiplistnode *insert_compare(apr_skiplist *sl, void *data,
sl->height = 1;
sl->topend = sl->bottomend = sl->top = sl->bottom =
(apr_skiplistnode *)apr_skiplist_alloc(sl, sizeof(apr_skiplistnode));
-#if 0
- sl->top->next = (apr_skiplistnode *)NULL;
- sl->top->data = (apr_skiplistnode *)NULL;
- sl->top->prev = (apr_skiplistnode *)NULL;
- sl->top->up = (apr_skiplistnode *)NULL;
- sl->top->down = (apr_skiplistnode *)NULL;
- sl->top->nextindex = (apr_skiplistnode *)NULL;
- sl->top->previndex = (apr_skiplistnode *)NULL;
-#endif
+ sl->top->next = NULL;
+ sl->top->data = NULL;
+ sl->top->prev = NULL;
+ sl->top->up = NULL;
+ sl->top->down = NULL;
+ sl->top->nextindex = NULL;
+ sl->top->previndex = NULL;
sl->top->sl = sl;
}
if (sl->preheight) {