]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Minor issues...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Apr 2021 23:21:51 +0000 (18:21 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Apr 2021 23:22:15 +0000 (18:22 -0500)
src/lib/util/rb.c
src/lib/util/rb.h

index ef7c8081bfe191c0f8e875869300e17f8e917814..d4ff8162c05f9dedf940a8231c9d4c208d00ab7d 100644 (file)
@@ -33,7 +33,7 @@ static fr_rb_node_t sentinel = { NIL, NIL, NULL, NULL, BLACK, false };
 #  define RB_MAGIC (0x5ad09c42)
 #endif
 
-static int insert_node(fr_rb_node_t **existing, fr_rb_tree_t *tree, void *data) CC_HINT(nonnull);
+static int insert_node(fr_rb_node_t **existing, fr_rb_tree_t *tree, void *data) CC_HINT(nonnull(2,3));
 
 static inline CC_HINT(always_inline) void node_data_free(fr_rb_tree_t const *tree, fr_rb_node_t *node)
 {
@@ -346,7 +346,7 @@ static int insert_node(fr_rb_node_t **existing, fr_rb_tree_t *tree, void *data)
 {
        fr_rb_node_t *current, *parent, *x;
 
-       if (unlikely(tree->being_freed)) return NULL;
+       if (unlikely(tree->being_freed)) return -1;
 
 #ifndef TALLOC_GET_TYPE_ABORT_NOOP
        if (tree->type) (void)_talloc_get_type_abort(data, tree->type, __location__);
@@ -364,7 +364,7 @@ static int insert_node(fr_rb_node_t **existing, fr_rb_tree_t *tree, void *data)
                result = tree->data_cmp(data, current->data);
                if (result == 0) {
                        if (existing) *existing = current;
-                       return 1
+                       return 1;
                }
 
                parent = current;
@@ -598,7 +598,7 @@ int fr_rb_find_or_insert(void **found, fr_rb_tree_t *tree, void const *data)
 {
        fr_rb_node_t *existing;
 
-       switch (insert_node(existing, tree, UNCONST(void *, data))) {
+       switch (insert_node(&existing, tree, UNCONST(void *, data))) {
        case 1:
                if (found) *found = existing->data;
                return 1;
index 84df3ae3168c7451364c8331640f05893bd6a457..6a026a5f49533571d8b1c2c3c0cb24c0339000fc 100644 (file)
@@ -287,7 +287,7 @@ fr_rb_tree_t        *_fr_rb_alloc(TALLOC_CTX *ctx, ssize_t offset, char const *type,
 /** @hidecallergraph */
 void           *fr_rb_find(fr_rb_tree_t *tree, void const *data) CC_HINT(nonnull);
 
-int            fr_rb_find_or_insert(void **found, fr_rb_tree_t *tree, void const *data) CC_HINT(nonnull);
+int            fr_rb_find_or_insert(void **found, fr_rb_tree_t *tree, void const *data) CC_HINT(nonnull(2,3));
 
 bool           fr_rb_insert(fr_rb_tree_t *tree, void const *data) CC_HINT(nonnull);