From: Alan T. DeKok Date: Tue, 27 Apr 2021 15:38:10 +0000 (-0400) Subject: add htype to the struct X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b63c64dd02c455a953d64f3f9d523d089b4942c;p=thirdparty%2Ffreeradius-server.git add htype to the struct --- diff --git a/src/lib/util/htrie.c b/src/lib/util/htrie.c index 41b5b0fb6fe..433f28da2f5 100644 --- a/src/lib/util/htrie.c +++ b/src/lib/util/htrie.c @@ -93,6 +93,7 @@ fr_htrie_t *fr_htrie_alloc(TALLOC_CTX *ctx, fr_strerror_const("Failed allocating fr_htrie_t"); return NULL; } + ht->type = type; switch (type) { case FR_HTRIE_HASH: diff --git a/src/lib/util/htrie.h b/src/lib/util/htrie.h index 68396e9292e..dfb39b86f0a 100644 --- a/src/lib/util/htrie.h +++ b/src/lib/util/htrie.h @@ -46,6 +46,13 @@ typedef bool (*fr_htrie_delete_t)(fr_htrie_t *ht, void const *data); typedef uint32_t (*fr_htrie_num_elements_t)(fr_htrie_t *ht); +typedef enum { + FR_HTRIE_INVALID = 0, + FR_HTRIE_HASH, //!< Data is stored in a hash. + FR_HTRIE_RB, //!< Data is stored in a rb tree. + FR_HTRIE_TRIE, //!< Data is stored in a prefix trie. +} fr_htrie_type_t; + /** Which functions are used for the different operations * */ @@ -63,17 +70,11 @@ typedef struct { * */ struct fr_htrie_s { + fr_htrie_type_t type; //!< type of the htrie void *store; //!< What we're using to store node data fr_htrie_funcs_t funcs; //!< Function pointers for the various operations. }; -typedef enum { - FR_HTRIE_INVALID = 0, - FR_HTRIE_HASH, //!< Data is stored in a hash. - FR_HTRIE_RB, //!< Data is stored in a rb tree. - FR_HTRIE_TRIE, //!< Data is stored in a prefix trie. -} fr_htrie_type_t; - fr_htrie_t *fr_htrie_alloc(TALLOC_CTX *ctx, fr_htrie_type_t type, fr_hash_t hash_data,