]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add missing public "replace" function
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Apr 2021 19:49:40 +0000 (14:49 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 16 Apr 2021 19:49:40 +0000 (14:49 -0500)
src/lib/util/htrie.h

index e86b44bab2456973eddb14efb2b1672fe9a80fba..c721f43f381413b41e089f6d257cf4b44589b634 100644 (file)
@@ -78,26 +78,49 @@ fr_htrie_t *fr_htrie_alloc(TALLOC_CTX *ctx,
                           fr_trie_key_t get_key,
                           fr_free_t free_data);
 
+/** Find data in a htrie
+ *
+ */
 static inline CC_HINT(nonnull) void *fr_htrie_find(fr_htrie_t *ht, void const *data)
 {
        return ht->funcs.find(ht->store, data);
 }
 
-static inline CC_HINT(nonnull) int fr_htrie_insert(fr_htrie_t *ht, void const *data)
+/** Insert data into a htrie
+ *
+ */
+static inline CC_HINT(nonnull) bool fr_htrie_insert(fr_htrie_t *ht, void const *data)
 {
        return ht->funcs.insert(ht->store, data);
 }
 
-static inline CC_HINT(nonnull) int fr_htrie_delete(fr_htrie_t *ht, void const *data)
+/** Replace data in a htrie, freeing previous data if free_data cb was passed to fr_htrie_alloc
+ *
+ */
+static inline CC_HINT(nonnull) int fr_htrie_replace(fr_htrie_t *ht, void const *data)
 {
-       return ht->funcs.delete(ht->store, data);
+       return ht->funcs.replace(ht->store, data);
 }
 
-static inline CC_HINT(nonnull) int fr_htrie_replace(fr_htrie_t *ht, void const *data)
+/** Remove data from a htrie without freeing it
+ *
+ */
+static inline CC_HINT(nonnull) int fr_htrie_remove(fr_htrie_t *ht, void const *data)
 {
-       return ht->funcs.replace(ht->store, data);
+       return ht->funcs.remove(ht->store, data);
+}
+
+/** Delete data from a htrie, freeing it if free_data cb was passed to fr_htrie_alloc
+ *
+ */
+static inline CC_HINT(nonnull) bool fr_htrie_delete(fr_htrie_t *ht, void const *data)
+{
+       return ht->funcs.delete(ht->store, data);
 }
 
+/** Return the number of elements in the htrie
+ *
+ */
 static inline CC_HINT(nonnull) int fr_htrie_num_elements(fr_htrie_t *ht)
 {
        return ht->funcs.num_elements(ht->store);