From d64f14af4e1bbae818e44bdd137f6481e65cc6c1 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 1 Feb 2011 12:00:07 +0100 Subject: [PATCH] rbtree: remove unused arguments from INIT macro. --- docs/technical/rbtree.txt | 4 ++-- src/inotify-map.c | 4 ++-- src/rbtree.h | 2 +- test/t_rbtree.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/technical/rbtree.txt b/docs/technical/rbtree.txt index 6191146..634a0a6 100644 --- a/docs/technical/rbtree.txt +++ b/docs/technical/rbtree.txt @@ -9,10 +9,10 @@ Initialize a `rbtree` structure. + should only be used with the declaration like: + ---- -rbtree tree = RBTREE_INIT(...); +rbtree tree = RBTREE_INIT(cmp); ---- + -the arguments are pointers to callback functions, in order: `delete_fn`, `update_fn`, `cmp_fn` +will expand to set the compare function 'cmp' to the `cmp_fn` member. Data structures ~~~~~~~~~~~~~~~ diff --git a/src/inotify-map.c b/src/inotify-map.c index 40dcb1a..6139aa6 100644 --- a/src/inotify-map.c +++ b/src/inotify-map.c @@ -31,8 +31,8 @@ static void wd_free(void *ptr); static int wd_cmp(const void *a, const void *b); static int path_cmp(const void *a, const void *b); -static rbtree tree_wd_paths = RBTREE_INIT(wd_free, NULL, wd_cmp); -static rbtree tree_path_wd = RBTREE_INIT(xfree, NULL, path_cmp); +static rbtree tree_wd_paths = RBTREE_INIT(wd_cmp); +static rbtree tree_path_wd = RBTREE_INIT(path_cmp); static int wd_cmp(const void *a, const void *b) { diff --git a/src/rbtree.h b/src/rbtree.h index b1a4b19..e424113 100644 --- a/src/rbtree.h +++ b/src/rbtree.h @@ -19,7 +19,7 @@ typedef struct { int (*cmp_fn)(const void *, const void *); } rbtree; -#define RBTREE_INIT(delete, update, cmp) { NULL, cmp } +#define RBTREE_INIT(cmp) { NULL, cmp } int rbtree_is_empty(rbtree *tree); diff --git a/test/t_rbtree.c b/test/t_rbtree.c index 4bbfa2b..b256c4b 100644 --- a/test/t_rbtree.c +++ b/test/t_rbtree.c @@ -12,7 +12,7 @@ static int vcmp(const void *a, const void *b); static void vdelete(void *ptr); /* data */ -static rbtree tree = RBTREE_INIT(NULL, NULL, vcmp); +static rbtree tree = RBTREE_INIT(vcmp); static int keyref[NODES]; static int vcmp(const void *a, const void *b) {