Mercurial > hg > nnchat
changeset 453:d55cc0b73c62
Merge nn_user_free_list() into a parent function.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 26 May 2012 05:16:16 +0300 |
parents | aeb3171f9e28 |
children | 423a54af68d4 |
files | util.c |
diffstat | 1 files changed, 9 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/util.c Sat May 26 05:10:11 2012 +0300 +++ b/util.c Sat May 26 05:16:16 2012 +0300 @@ -442,19 +442,6 @@ } -static void nn_user_free_list(nn_user_t *list) -{ - nn_user_t *next, *curr = list; - - while (curr != NULL) - { - next = curr->next; - nn_user_free(curr); - curr = next; - } -} - - nn_user_t *nn_userhash_foreach(const nn_userhash_t *list, int (*func)(const nn_user_t *)) { int i; @@ -630,7 +617,15 @@ for (i = 0; i < NN_NUM_BUCKETS; i++) { - nn_user_free_list(hash->buckets[i]); + nn_user_t *curr = hash->buckets[i]; + + while (curr != NULL) + { + nn_user_t *next = curr->next; + nn_user_free(curr); + curr = next; + } + hash->buckets[i] = NULL; }