aboutsummaryrefslogtreecommitdiff
path: root/tests/test38.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-12-01 13:33:34 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-12-01 13:33:34 +0100
commitc8bf38e5fb717d40635a2a89b22ed71b0de4266b (patch)
tree63751b2f5497c6f99e1c6a78f23a8e6e5c49833f /tests/test38.c
Squashed 'dependencies/uthash/' content from commit 8e67ced
git-subtree-dir: dependencies/uthash git-subtree-split: 8e67ced1d1c5bd8141c542a22630e6de78aa6b90
Diffstat (limited to 'tests/test38.c')
-rw-r--r--tests/test38.c31
1 files changed, 31 insertions, 0 deletions
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 <stdlib.h>
+#include <stdio.h>
+
+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;
+}