From: Alan T. DeKok Date: Thu, 4 Jan 2018 18:26:22 +0000 (-0500) Subject: set DEFAULT_SIZE=1 when no path compression X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4710330f31cd0d92a4bfee41e6d3bd49f9edcb93;p=thirdparty%2Ffreeradius-server.git set DEFAULT_SIZE=1 when no path compression which makes it work... will track things down later. --- diff --git a/src/lib/util/trie.c b/src/lib/util/trie.c index 0889aa077d2..89bf9a3a0a9 100644 --- a/src/lib/util/trie.c +++ b/src/lib/util/trie.c @@ -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; diff --git a/src/tests/trie/nopc.mk b/src/tests/trie/nopc.mk index ab57f21024a..a4234d83f9b 100644 --- a/src/tests/trie/nopc.mk +++ b/src/tests/trie/nopc.mk @@ -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