diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-06-24 11:45:40 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2017-06-24 11:51:59 +0200 |
commit | 0ae85f6545b1d4a64836b0a3a5676a0bed9854d5 (patch) | |
tree | ec076c35f4770c1d9a1d9bd8df0b6b9bba1ba352 /src/common/utils.c | |
parent | 6eacbbe17ea7a7f523240400821a911589486d25 (diff) | |
download | blogc-0ae85f6545b1d4a64836b0a3a5676a0bed9854d5.tar.gz blogc-0ae85f6545b1d4a64836b0a3a5676a0bed9854d5.tar.bz2 blogc-0ae85f6545b1d4a64836b0a3a5676a0bed9854d5.zip |
utils: trie: fixed bug in foreach implementation.
when looping through the tree, the algorithm would stop, if found a '\0'
in the key of the tree node. there should be no "child" field after a '\0',
but "next" fields may exist.
Diffstat (limited to 'src/common/utils.c')
-rw-r--r-- | src/common/utils.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/common/utils.c b/src/common/utils.c index 1ed79bf..97fa671 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -615,10 +615,8 @@ bc_trie_foreach_node(bc_trie_node_t *node, bc_string_t *str, if (node == NULL || str == NULL || func == NULL) return; - if (node->key == '\0') { + if (node->key == '\0') func(str->str, node->data, user_data); - return; - } if (node->child != NULL) { bc_string_t *child = bc_string_dup(str); |