From: Luke Heberling Date: Thu, 13 Dec 2007 07:09:16 +0000 (+0100) Subject: src/utils_avltree.c: Fix avl_get to work as documented. X-Git-Tag: collectd-4.2.2~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3b915093d8cbc7738b2de59f6ebc38f195131002;p=collectd.git src/utils_avltree.c: Fix avl_get to work as documented. The documentation in the header file for avl_get states that value may be null, but the code in the source file asserts otherwise. This patch changes the code to reflect the documentation. Signed-off-by: Florian Forster --- diff --git a/src/utils_avltree.c b/src/utils_avltree.c index 09cf2e6f..11d3d716 100644 --- a/src/utils_avltree.c +++ b/src/utils_avltree.c @@ -581,13 +581,12 @@ int avl_get (avl_tree_t *t, const void *key, void **value) { avl_node_t *n; - assert (value != NULL); - n = search (t, key); if (n == NULL) return (-1); - *value = n->value; + if (value != NULL) + *value = n->value; return (0); }