aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/radix.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/radix.h')
-rw-r--r--src/libutil/radix.h38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/libutil/radix.h b/src/libutil/radix.h
index 88f345e3d..cfdefa25b 100644
--- a/src/libutil/radix.h
+++ b/src/libutil/radix.h
@@ -7,29 +7,30 @@
#define RADIX_NO_VALUE (uintptr_t)-1
-typedef struct radix_node_s radix_node_t;
+typedef struct radix_node_s radix_node_t;
struct radix_node_s {
- radix_node_t *right;
- radix_node_t *left;
- radix_node_t *parent;
- uintptr_t value;
+ radix_node_t *right;
+ radix_node_t *left;
+ radix_node_t *parent;
+ uintptr_t value;
guint32 key;
};
typedef struct {
- radix_node_t *root;
- size_t size;
+ radix_node_t *root;
+ size_t size;
rspamd_mempool_t *pool;
} radix_tree_t;
-typedef gboolean (*radix_tree_traverse_func)(guint32 key, guint32 mask, uintptr_t value, void *user_data);
+typedef gboolean (*radix_tree_traverse_func)(guint32 key, guint32 mask,
+ uintptr_t value, void *user_data);
/**
* Create new radix tree
*/
-radix_tree_t *radix_tree_create (void);
+radix_tree_t * radix_tree_create (void);
/**
* Insert value to radix tree
@@ -37,7 +38,10 @@ radix_tree_t *radix_tree_create (void);
* 0 if operation was successfull
* -1 if there was some error
*/
-gint radix32tree_insert (radix_tree_t *tree, guint32 key, guint32 mask, uintptr_t value);
+gint radix32tree_insert (radix_tree_t *tree,
+ guint32 key,
+ guint32 mask,
+ uintptr_t value);
/**
* Add value to radix tree or insert it if value does not exists
@@ -45,7 +49,10 @@ gint radix32tree_insert (radix_tree_t *tree, guint32 key, guint32 mask, uintptr_
* 0 if value was inserted
* -1 if there was some error
*/
-uintptr_t radix32tree_add (radix_tree_t *tree, guint32 key, guint32 mask, uintptr_t value);
+uintptr_t radix32tree_add (radix_tree_t *tree,
+ guint32 key,
+ guint32 mask,
+ uintptr_t value);
/**
* Replace value in radix tree or insert it if value does not exists
@@ -53,7 +60,10 @@ uintptr_t radix32tree_add (radix_tree_t *tree, guint32 key, guint32 mask, uintpt
* 0 if value was inserted
* -1 if there was some error
*/
-gint radix32tree_replace (radix_tree_t *tree, guint32 key, guint32 mask, uintptr_t value);
+gint radix32tree_replace (radix_tree_t *tree,
+ guint32 key,
+ guint32 mask,
+ uintptr_t value);
/**
* Delete value from radix tree
@@ -81,7 +91,9 @@ uintptr_t radix32_tree_find_addr (radix_tree_t *tree, rspamd_inet_addr_t *addr);
/**
* Traverse via the whole tree calling specified callback
*/
-void radix32tree_traverse (radix_tree_t *tree, radix_tree_traverse_func func, void *user_data);
+void radix32tree_traverse (radix_tree_t *tree,
+ radix_tree_traverse_func func,
+ void *user_data);
/**
* Frees radix tree