Commit 265c8661a625a0ca126e5e1ae65cb82a3d032dac
1 parent
077376be
only trigger the if action is not null during walk or destroy
Showing
4 changed files
with
8 additions
and
12 deletions
@@ -35,14 +35,6 @@ hashCtor(void * _this, va_list * params) | @@ -35,14 +35,6 @@ hashCtor(void * _this, va_list * params) | ||
35 | } | 35 | } |
36 | 36 | ||
37 | static | 37 | static |
38 | -inline | ||
39 | -void | ||
40 | -tDelete(const void * node, const int depth) | ||
41 | -{ | ||
42 | - TR_delete(node); | ||
43 | -} | ||
44 | - | ||
45 | -static | ||
46 | void | 38 | void |
47 | hashDtor(void * _this) | 39 | hashDtor(void * _this) |
48 | { | 40 | { |
@@ -46,7 +46,9 @@ TR_treeDestroy(TR_Tree * this, TR_TreeAction action) | @@ -46,7 +46,9 @@ TR_treeDestroy(TR_Tree * this, TR_TreeAction action) | ||
46 | 46 | ||
47 | TR_Tree parent = TR_TREE_PARENT(node); | 47 | TR_Tree parent = TR_TREE_PARENT(node); |
48 | 48 | ||
49 | - action(node->data, depth); | 49 | + if (action) { |
50 | + action(node->data, depth); | ||
51 | + } | ||
50 | 52 | ||
51 | previous = node; | 53 | previous = node; |
52 | TR_delete(node); | 54 | TR_delete(node); |
@@ -38,7 +38,9 @@ TR_treeWalk(TR_Tree this, TR_TreeAction action) | @@ -38,7 +38,9 @@ TR_treeWalk(TR_Tree this, TR_TreeAction action) | ||
38 | } | 38 | } |
39 | 39 | ||
40 | if (NULL == TR_TREE_LEFT(node) || previous == TR_TREE_LEFT(node)) { | 40 | if (NULL == TR_TREE_LEFT(node) || previous == TR_TREE_LEFT(node)) { |
41 | - action(node->data, depth); | 41 | + if (action) { |
42 | + action(node->data, depth); | ||
43 | + } | ||
42 | previous = node; | 44 | previous = node; |
43 | 45 | ||
44 | if (NULL != TR_TREE_RIGHT(node)) { | 46 | if (NULL != TR_TREE_RIGHT(node)) { |
@@ -11,13 +11,13 @@ | @@ -11,13 +11,13 @@ | ||
11 | #define HAVE_MEMORY_H 1 | 11 | #define HAVE_MEMORY_H 1 |
12 | 12 | ||
13 | /* Define to 1 if you have the `memset' function. */ | 13 | /* Define to 1 if you have the `memset' function. */ |
14 | -#define HAVE_MEMSET 1 | 14 | +/* #undef HAVE_MEMSET */ |
15 | 15 | ||
16 | /* Define to 1 if you have the <stdarg.h> header file. */ | 16 | /* Define to 1 if you have the <stdarg.h> header file. */ |
17 | #define HAVE_STDARG_H 1 | 17 | #define HAVE_STDARG_H 1 |
18 | 18 | ||
19 | /* Define to 1 if stdbool.h conforms to C99. */ | 19 | /* Define to 1 if stdbool.h conforms to C99. */ |
20 | -#define HAVE_STDBOOL_H 1 | 20 | +/* #undef HAVE_STDBOOL_H */ |
21 | 21 | ||
22 | /* Define to 1 if you have the <stdint.h> header file. */ | 22 | /* Define to 1 if you have the <stdint.h> header file. */ |
23 | #define HAVE_STDINT_H 1 | 23 | #define HAVE_STDINT_H 1 |
Please
register
or
login
to post a comment