From: Marko Kreen Date: Thu, 12 Jun 2014 18:50:47 +0000 (+0300) Subject: Remove use of USUAL_ALLOC X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=dc5eb35407a35ea67d3ae8981decec0a40047024;p=libusual.git Remove use of USUAL_ALLOC --- diff --git a/test/compile.c b/test/compile.c index 59a36b6..f9bfabd 100644 --- a/test/compile.c +++ b/test/compile.c @@ -41,7 +41,7 @@ int main(void) static_assert(sizeof(int) >= 4, "unsupported int size"); aatree_init(&aatree, NULL, NULL); - cbtree = cbtree_create(NULL, NULL, NULL, USUAL_ALLOC); + cbtree = cbtree_create(NULL, NULL, NULL, NULL); cbtree_destroy(cbtree); daemonize(NULL, false); hash_lookup3("foo", 3); diff --git a/test/test_cbtree.c b/test/test_cbtree.c index f52fdb6..0af97ed 100644 --- a/test/test_cbtree.c +++ b/test/test_cbtree.c @@ -82,7 +82,7 @@ static void test_cbtree_basic(void *p) struct CBTree *tree; int i; - tree = cbtree_create(my_getkey, my_node_free, NULL, USUAL_ALLOC); + tree = cbtree_create(my_getkey, my_node_free, NULL, NULL); str_check(my_search(tree, 1), "not found"); @@ -138,7 +138,7 @@ static void test_cbtree_random(void *p) srandom(123123); memset(is_added, 0, sizeof(is_added)); - tree = cbtree_create(my_getkey, my_node_free, NULL, USUAL_ALLOC); + tree = cbtree_create(my_getkey, my_node_free, NULL, NULL); while (total < 20000) { int r = random() & 15; diff --git a/test/test_crypto.c b/test/test_crypto.c index 6519267..ed13606 100644 --- a/test/test_crypto.c +++ b/test/test_crypto.c @@ -90,7 +90,7 @@ static const char *run_hash(const char *str, const char *hexstr, const struct Di len = strlen(str); } - ctx = digest_new(impl, USUAL_ALLOC); + ctx = digest_new(impl, NULL); if (!ctx) return "NOMEM"; reslen = digest_result_len(ctx); @@ -389,7 +389,7 @@ static const char *run_variable(const char *hex, const struct DigestInfo *mdinfo len = strlen(hex) / 2; buf = fromhex(hex, len); - ctx = digest_new(mdinfo, USUAL_ALLOC); + ctx = digest_new(mdinfo, NULL); if (!ctx) return "NOMEM"; digest_update(ctx, buf, len); @@ -469,7 +469,7 @@ static const char *run_hmac(const char *key, const char *str, const struct Diges int len = strlen(str); int reslen; - ctx = hmac_new(impl, key, strlen(key), USUAL_ALLOC); + ctx = hmac_new(impl, key, strlen(key), NULL); if (!ctx) return "NOMEM"; reslen = hmac_result_len(ctx); diff --git a/test/test_hashtab.c b/test/test_hashtab.c index 5f2c08e..cb4579e 100644 --- a/test/test_hashtab.c +++ b/test/test_hashtab.c @@ -98,7 +98,7 @@ static void test_hash_basic(void *p) struct HashTab *htab; int i; - htab = hashtab_create(cf_size, mycmp, USUAL_ALLOC); + htab = hashtab_create(cf_size, mycmp, NULL); for (i = 0; i < cf_cnt; i++) { int n = i + cf_ofs; diff --git a/test/test_heap.c b/test/test_heap.c index fd6270d..1a858da 100644 --- a/test/test_heap.c +++ b/test/test_heap.c @@ -129,7 +129,7 @@ static void test_heap_basic(void *p) struct Heap *heap; int i; - heap = heap_create(heap_is_better, my_save_pos, USUAL_ALLOC); + heap = heap_create(heap_is_better, my_save_pos, NULL); str_check(my_remove(heap, 0), "NEXIST"); str_check(my_insert(heap, 0), "OK"); diff --git a/test/test_mdict.c b/test/test_mdict.c index 5f64187..5dcd643 100644 --- a/test/test_mdict.c +++ b/test/test_mdict.c @@ -16,7 +16,7 @@ static void test_mdict(void *p) struct MBuf buf; const char *s; - d = mdict_new(USUAL_ALLOC); + d = mdict_new(NULL); str_check(xget(d, "key"), "NULL"); int_check(mdict_put(d, "key", "val"), 1); int_check(mdict_put(d, "key2", "foo"), 1); @@ -39,7 +39,7 @@ static void test_mdict(void *p) mdict_free(d); - d = mdict_new(USUAL_ALLOC); + d = mdict_new(NULL); s = "key=val&key2=&key3"; int_check(mdict_urldecode(d, s, strlen(s)), 1); str_check(xget(d, "key"), "val"); diff --git a/test/test_pgutil.c b/test/test_pgutil.c index f4e3ede..b378954 100644 --- a/test/test_pgutil.c +++ b/test/test_pgutil.c @@ -118,7 +118,7 @@ end:; static char *aparse(const char *src) { - struct StrList *sl = pg_parse_array(src, USUAL_ALLOC); + struct StrList *sl = pg_parse_array(src, NULL); static char buf[1024]; char *dst = buf; const char *s; diff --git a/test/test_string.c b/test/test_string.c index ee90d99..b321961 100644 --- a/test/test_string.c +++ b/test/test_string.c @@ -195,7 +195,7 @@ static void test_strlist(void *p) { struct StrList *sl = NULL; const char *s; - sl = strlist_new(USUAL_ALLOC); + sl = strlist_new(NULL); str_check(lshow(sl), ""); strlist_append(sl, "1"); str_check(lshow(sl), "1"); @@ -220,7 +220,7 @@ static bool sl_add(void *arg, const char *s) static const char *wlist(const char *s) { const char *res = "FAIL"; - struct StrList *sl = strlist_new(USUAL_ALLOC); + struct StrList *sl = strlist_new(NULL); bool ok = parse_word_list(s, sl_add, sl); if (ok) { if (strlist_empty(sl)) diff --git a/test/test_strpool.c b/test/test_strpool.c index e0cd0c1..4523abc 100644 --- a/test/test_strpool.c +++ b/test/test_strpool.c @@ -10,11 +10,11 @@ static void test_strpool(void *p) struct StrPool *pool; struct PStr *s; - pool = strpool_create(USUAL_ALLOC); + pool = strpool_create(NULL); tt_assert(pool); strpool_free(pool); - pool = strpool_create(USUAL_ALLOC); + pool = strpool_create(NULL); tt_assert(pool); int_check(strpool_total(pool), 0); @@ -42,7 +42,7 @@ static void test_strpool(void *p) strpool_free(pool); /* free strc with strings */ - pool = strpool_create(USUAL_ALLOC); + pool = strpool_create(NULL); tt_assert(pool); s = strpool_get(pool, "foo", -1); s = strpool_get(pool, "bar", 3); diff --git a/usual/event.c b/usual/event.c index b98df6e..feaaef1 100644 --- a/usual/event.c +++ b/usual/event.c @@ -260,7 +260,7 @@ struct event_base *event_base_new(void) return NULL; /* initialize timeout and fd areas */ - base->timeout_heap = heap_create(ev_is_better, ev_save_pos, USUAL_ALLOC); + base->timeout_heap = heap_create(ev_is_better, ev_save_pos, NULL); if (!base->timeout_heap) { free(base); return NULL; diff --git a/usual/hashtab-impl.h b/usual/hashtab-impl.h index eaf54b3..9f9d5d6 100644 --- a/usual/hashtab-impl.h +++ b/usual/hashtab-impl.h @@ -247,7 +247,7 @@ static inline void _hashtab_example(void) unsigned nitem, nlink; struct HashTab *h, *h2; - h = hashtab_create(1024, NULL, USUAL_ALLOC); + h = hashtab_create(1024, NULL, NULL); hashtab_lookup(h, 123, true, NULL); hashtab_stats(h, &nitem, &nlink); h2 = hashtab_copy(h, 2048);