From 7cd2facc5e75815e1e49386539185ca0c797db9d Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Thu, 21 Jul 2022 01:18:38 +0300 Subject: [PATCH] 7 --- src/Hashtable2/Hashtable2.hpp | 6 ++++-- src/base/types.h | 1 + tests/test_searchtree.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Hashtable2/Hashtable2.hpp b/src/Hashtable2/Hashtable2.hpp index 7be4a64..63fd667 100644 --- a/src/Hashtable2/Hashtable2.hpp +++ b/src/Hashtable2/Hashtable2.hpp @@ -2,6 +2,7 @@ #include "../HashFunctions/hash.h" #include "../Autoarr2/Autoarr2.hpp" +#include // amount of rows typedef uint32 HT_HEIGHT_T; @@ -27,8 +28,9 @@ class Hashtable2{ HT_HASH_T hash; #endif }; - using HashKeyFunc_t=HT_HASH_T (*)(TKey); - using KeyCmpFunc_t=bool (*)(TKey, TKey); + //using HashKeyFunc_t=HT_HASH_T (*)(TKey); + using HashKeyFunc_t=std::function; + using KeyCmpFunc_t=std::function; // fields Autoarr2** rows; diff --git a/src/base/types.h b/src/base/types.h index 058e4c0..b6de6ea 100644 --- a/src/base/types.h +++ b/src/base/types.h @@ -26,6 +26,7 @@ typedef enum __attribute__((__packed__)) my_type { AutoarrInt32Ptr, AutoarrUInt32Ptr, AutoarrInt64Ptr, AutoarrUInt64Ptr, AutoarrUnitypePtr, AutoarrKVPairPtr } my_type; +static const my_type my_type_last=AutoarrKVPairPtr; const char* my_type_name(my_type t); diff --git a/tests/test_searchtree.c b/tests/test_searchtree.c index cdaf0ed..2cb24a1 100644 --- a/tests/test_searchtree.c +++ b/tests/test_searchtree.c @@ -47,7 +47,7 @@ void test_searchtree(){ printuni(u); ST_push(node,"message_id", u); printf(" -> message_id\n "); - u=(Unitype){.type=Int8Ptr,.VoidPtr=malloc(1)}; + u=(Unitype){.type=CharPtr,.VoidPtr=cptr_copy("some text UwU")}; printuni(u); ST_push(node,"text", u); printf(" -> text\n");