Mercurial > hg > nnchat
diff util.c @ 485:ad7ddce47878
Improve nn_userhash_foreach() by adding user data parameter.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 26 May 2012 15:30:46 +0300 |
parents | 607bd4491e79 |
children | 73f8df0ecffe |
line wrap: on
line diff
--- a/util.c Sat May 26 09:01:04 2012 +0300 +++ b/util.c Sat May 26 15:30:46 2012 +0300 @@ -473,7 +473,7 @@ } -nn_user_t *nn_userhash_foreach(const nn_userhash_t *list, int (*func)(const nn_user_t *)) +nn_user_t *nn_userhash_foreach(const nn_userhash_t *list, int (*func)(const nn_user_t *, void *userdata), void *data) { int i; @@ -485,7 +485,7 @@ nn_user_t *curr = list->buckets[i]; while (curr != NULL) { - if (func(curr) != 0) + if (func(curr, data) != 0) return curr; curr = curr->next; }