]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add htype to the struct
authorAlan T. DeKok <aland@freeradius.org>
Tue, 27 Apr 2021 15:38:10 +0000 (11:38 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 27 Apr 2021 21:02:24 +0000 (17:02 -0400)
src/lib/util/htrie.c
src/lib/util/htrie.h

index 41b5b0fb6fe172ad88ad308f4411476b4adbea6a..433f28da2f52ba08fe4ab51a7004754f05ec4b56 100644 (file)
@@ -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:
index 68396e9292eaed4064a9affd1f7b484f3771b352..dfb39b86f0a2c211ea8012b4a5809103d997be8c 100644 (file)
@@ -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,