From a10a8fb335e5a817e1a9add49ee179394eea67c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 26 Dec 2021 19:52:31 +0100 Subject: fixed parser, fixed leak, O(log n) storage - tsearch(3) - 0.0.17 --- test/tsearch.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/tsearch.c (limited to 'test') diff --git a/test/tsearch.c b/test/tsearch.c new file mode 100644 index 0000000..45c4eef --- /dev/null +++ b/test/tsearch.c @@ -0,0 +1,15 @@ +#include +#include +#include +#define CAST (int (*) (const void *, const void *)) +int compar (const char * a, const char * b) { + return strcmp(a, b); +} +int main () { + void * root = NULL; + tsearch("key1", &root, CAST compar); + tsearch("key1", &root, CAST compar); + tsearch("key2", &root, CAST compar); + fprintf(stdout, "this should say key1: %s\n", *(char **) tfind("key1", &root, CAST compar)); + return 0; +} -- cgit v1.2.3