From c8bf38e5fb717d40635a2a89b22ed71b0de4266b Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 1 Dec 2020 13:33:34 +0100 Subject: Squashed 'dependencies/uthash/' content from commit 8e67ced git-subtree-dir: dependencies/uthash git-subtree-split: 8e67ced1d1c5bd8141c542a22630e6de78aa6b90 --- tests/test38.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/test38.c (limited to 'tests/test38.c') diff --git a/tests/test38.c b/tests/test38.c new file mode 100644 index 000000000..dc9dae94e --- /dev/null +++ b/tests/test38.c @@ -0,0 +1,31 @@ +#include "uthash.h" +#include +#include + +struct test_t { + int a; + UT_hash_handle hh; +}; + +int main() +{ + struct test_t *tests=NULL, *test; + int a, b; + for (b=0; b < 3; b++) { + for (a=0; a < 10; a++) { + test = NULL; + HASH_FIND(hh, tests, &a, sizeof(a), test); + if (test == NULL) { + test = (struct test_t*)malloc(sizeof(struct test_t)); + if (test == NULL) { + exit(-1); + } + memset(test, 0, sizeof(struct test_t)); + test->a = a; + HASH_ADD(hh, tests, a, sizeof(a), test); + } + } + } + printf("hash count %u\n", HASH_COUNT(tests)); + return 0; +} -- cgit v1.2.3