test_dtsod() improved and memory leaks fixed

This commit is contained in:
2022-03-09 18:47:13 +03:00
parent 8819853e15
commit 3c1d92d79a
8 changed files with 56 additions and 33 deletions

View File

@@ -70,7 +70,7 @@ Unitype* Hashtable_getptr(Hashtable* ht, char* key){
uint32 arlen=Autoarr_length(ar);
for(uint32 i=0;i<arlen;i++){
KeyValuePair* p=Autoarr_getptr(ar,i);
if(charbuf_compare(key,p->key)) return &p->value;
if(cptr_compare(key,p->key)) return &p->value;
}
return NULL;
}
@@ -80,7 +80,7 @@ Unitype Hashtable_get(Hashtable* ht, char* key){
uint32 arlen=Autoarr_length(ar);
for(uint32 i=0;i<arlen;i++){
KeyValuePair p=Autoarr_get(ar,i);
if(charbuf_compare(key,p.key)) return p.value;
if(cptr_compare(key,p.key)) return p.value;
}
return UniNull;
}

View File

@@ -16,7 +16,7 @@ void Hashtable_free(Hashtable* ht);
uint32 Hashtable_height(Hashtable* ht);
//adds charptr and value to new KeyValuePair
//use charbuf_copy() to create new string if needed
//use cptr_copy() to create new string if needed
#define KVPair(key,value) (KeyValuePair){key,value}