int next_grow;
int mask;
- fr_hash_table_free_t free;
- fr_hash_table_hash_t hash;
- fr_hash_table_cmp_t cmp;
+ fr_free_t free;
+ fr_hash_t hash;
+ fr_tmp_cmp_t cmp;
fr_hash_entry_t null;
* Memory usage in bytes is (20/3) * number of entries.
*/
fr_hash_table_t *fr_hash_table_create(TALLOC_CTX *ctx,
- fr_hash_table_hash_t hash_func,
- fr_hash_table_cmp_t cmp_func,
- fr_hash_table_free_t free_func)
+ fr_hash_t hash_func,
+ fr_tmp_cmp_t cmp_func,
+ fr_free_t free_func)
{
fr_hash_table_t *ht;
extern "C" {
#endif
-#include <freeradius-devel/build.h>
-#include <freeradius-devel/missing.h>
-#include <freeradius-devel/util/talloc.h>
+#include <freeradius-devel/util/misc.h>
#include <stddef.h>
#include <stdint.h>
uint32_t fr_hash_case_string(char const *p);
typedef struct fr_hash_table_s fr_hash_table_t;
-typedef void (*fr_hash_table_free_t)(void *);
-typedef uint32_t (*fr_hash_table_hash_t)(void const *);
-typedef int (*fr_hash_table_cmp_t)(void const *, void const *);
typedef int (*fr_hash_table_walk_t)(void *data, void *uctx);
fr_hash_table_t *fr_hash_table_create(TALLOC_CTX *ctx,
- fr_hash_table_hash_t hashNode,
- fr_hash_table_cmp_t cmpNode,
- fr_hash_table_free_t freeNode);
+ fr_hash_t hashNode,
+ fr_tmp_cmp_t cmpNode,
+ fr_free_t freeNode);
int fr_hash_table_insert(fr_hash_table_t *ht, void const *data);
#include <signal.h>
typedef int8_t (*fr_cmp_t)(void const *a, void const *b);
+typedef int (*fr_tmp_cmp_t)(void const *a, void const *b);
+typedef void (*fr_free_t)(void *);
+typedef uint32_t (*fr_hash_t)(void const *);
/*
/* functions for FR_TYPE_STRUCTURAL */
fr_pair_list_t *fr_pair_children(fr_pair_t *head);
-/* Sorting */
-typedef int8_t (*fr_cmp_t)(void const *a, void const *b);
-
/** Compare two attributes using and operator.
*
* @return
char const *type; //!< Talloc type to check elements against.
size_t num_elements; //!< How many elements are inside the tree.
- fr_rb_cmp_t compare; //!< The comparator.
- fr_rb_free_t free; //!< Free function called when a node is freed.
+ fr_tmp_cmp_t compare; //!< The comparator.
+ fr_free_t free; //!< Free function called when a node is freed.
bool replace; //!< Allow replacements.
bool lock; //!< Ensure exclusive access.
*/
rbtree_t *_rbtree_alloc(TALLOC_CTX *ctx,
size_t offset, char const *type,
- fr_rb_cmp_t compare, fr_rb_free_t node_free,
+ fr_tmp_cmp_t compare, fr_free_t node_free,
int flags)
{
rbtree_t *tree;
extern "C" {
#endif
-#include <freeradius-devel/build.h>
-#include <freeradius-devel/missing.h>
-#include <freeradius-devel/util/talloc.h>
+#include <freeradius-devel/util/misc.h>
#include <stdbool.h>
#include <stdint.h>
#define RBTREE_FLAG_REPLACE (1 << 0)
#define RBTREE_FLAG_LOCK (1 << 1)
-typedef int (*fr_rb_cmp_t)(void const *one, void const *two);
-typedef void (*fr_rb_free_t)(void *data);
-
/** Creates a red black that verifies elements are of a specific talloc type
*
* @param[in] _ctx to tie tree lifetime to.
)
rbtree_t *_rbtree_alloc(TALLOC_CTX *ctx, size_t offset, char const *type,
- fr_rb_cmp_t compare, fr_rb_free_t node_free, int flags) CC_HINT(warn_unused_result);
+ fr_tmp_cmp_t compare, fr_free_t node_free, int flags) CC_HINT(warn_unused_result);
void rbtree_unlock(rbtree_t *tree) CC_HINT(nonnull);