]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set DEFAULT_SIZE=1 when no path compression
authorAlan T. DeKok <aland@freeradius.org>
Thu, 4 Jan 2018 18:26:22 +0000 (13:26 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 4 Jan 2018 18:26:22 +0000 (13:26 -0500)
which makes it work... will track things down later.

src/lib/util/trie.c
src/tests/trie/nopc.mk

index 0889aa077d213c7ba308d9af5ddf0adb759afd46..89bf9a3a0a90aea625339a4651c347a838dd0da8 100644 (file)
@@ -115,7 +115,10 @@ RCSID("$Id$")
 
 // @todo - make this configurable in fr_trie_t, and pass fr_trei_t to
 // all internal function.
+
+#ifndef DEFAULT_SIZE
 #define DEFAULT_SIZE   (4)
+#endif
 
 /*
  *     Macros to swap one for the other.
@@ -231,6 +234,10 @@ static fr_trie_node_t *fr_trie_node_alloc(TALLOC_CTX *ctx, int size)
                return NULL;
        }
 
+#ifndef WITH_PATH_COMPRESSION
+       if (size > DEFAULT_SIZE) size = DEFAULT_SIZE;
+#endif
+
        node_size = sizeof(fr_trie_node_t) + (sizeof(node->entry[0]) * (1 << size));
        node = talloc_zero_size(ctx, node_size);
        if (!node) return NULL;
index ab57f21024a4235f33b8252338f39728675b7d94..a4234d83f9b1fe6f3374b2be2147972023a30497 100644 (file)
@@ -1,6 +1,6 @@
 TARGET         := nopc
 
-SRC_CFLAGS     := -DTESTING -DNO_PATH_COMPRESSION
+SRC_CFLAGS     := -DTESTING -DNO_PATH_COMPRESSION -DDEFAULT_SIZE=1
 SOURCES                := nopc.c
 TGT_LDLIBS     := $(LIBS)
 TGT_PREREQS    := libfreeradius-util.a