diff options
Diffstat (limited to 'src/core/lib/support')
-rw-r--r-- | src/core/lib/support/avl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/lib/support/avl.c b/src/core/lib/support/avl.c index ceded9d266..acf8fd5a55 100644 --- a/src/core/lib/support/avl.c +++ b/src/core/lib/support/avl.c @@ -124,6 +124,15 @@ void *gpr_avl_get(gpr_avl avl, void *key) { return node ? node->value : NULL; } +int gpr_avl_maybe_get(gpr_avl avl, void *key, void **value) { + gpr_avl_node *node = get(avl.vtable, avl.root, key); + if (node != NULL) { + *value = node->value; + return 1; + } + return 0; +} + static gpr_avl_node *rotate_left(const gpr_avl_vtable *vtable, void *key, void *value, gpr_avl_node *left, gpr_avl_node *right) { |