nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 618c2d113760f1a98c33a135dd81693879c7e1d6
parent 43b7cb5e1c97005a3995c5d46da6ec5d4142e76e
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Sun, 10 May 2020 21:59:09 +0200

remove the "alloc" parameter from cdbmake_add() and cdbmake_split()

Both of these functions are only called from a single place, where both pass in
the alloc() function. The parameter was also named alloc, which can cause
compiler warnings when -Wshadow is enabled. Simply remove the parameter, which
makes everything work exactly as before.

Diffstat:
Mcdbmake_add.c | 8++++----
Mcdbmss.c | 4++--
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cdbmake_add.c b/cdbmake_add.c @@ -10,13 +10,13 @@ struct cdbmake *cdbm; cdbm->numentries = 0; } -int cdbmake_add(struct cdbmake *cdbm, uint32 h, uint32 p, char *(*alloc_fun)()) +int cdbmake_add(struct cdbmake *cdbm, uint32 h, uint32 p) { struct cdbmake_hplist *head; head = cdbm->head; if (!head || (head->num >= CDBMAKE_HPLIST)) { - head = (struct cdbmake_hplist *) alloc_fun(sizeof(struct cdbmake_hplist)); + head = (struct cdbmake_hplist *) alloc(sizeof(struct cdbmake_hplist)); if (!head) return 0; head->num = 0; head->next = cdbm->head; @@ -29,7 +29,7 @@ int cdbmake_add(struct cdbmake *cdbm, uint32 h, uint32 p, char *(*alloc_fun)()) return 1; } -int cdbmake_split(struct cdbmake *cdbm, char *(*alloc_fun)()) +int cdbmake_split(struct cdbmake *cdbm) { int i; uint32 u; @@ -57,7 +57,7 @@ int cdbmake_split(struct cdbmake *cdbm, char *(*alloc_fun)()) u /= sizeof(struct cdbmake_hp); if (memsize > u) return 0; - cdbm->split = (struct cdbmake_hp *) alloc_fun(memsize * sizeof(struct cdbmake_hp)); + cdbm->split = (struct cdbmake_hp *) alloc(memsize * sizeof(struct cdbmake_hp)); if (!cdbm->split) return 0; cdbm->hash = cdbm->split + cdbm->numentries; diff --git a/cdbmss.c b/cdbmss.c @@ -34,7 +34,7 @@ unsigned int datalen; for (i = 0;i < keylen;++i) h = cdbmake_hashadd(h,(unsigned int) key[i]); - if (!cdbmake_add(&c->cdbm,h,c->pos,alloc)) return -1; + if (!cdbmake_add(&c->cdbm,h,c->pos)) return -1; c->pos += 8 + keylen + datalen; /* XXX: overflow? */ return 0; @@ -47,7 +47,7 @@ struct cdbmss *c; uint32 len; uint32 u; - if (!cdbmake_split(&c->cdbm,alloc)) return -1; + if (!cdbmake_split(&c->cdbm)) return -1; for (i = 0;i < 256;++i) { len = cdbmake_throw(&c->cdbm,c->pos,i);