yet another ktid type system refactoring
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "Hashtable.h"
|
||||
|
||||
ktId_define(Hashtable);
|
||||
ktId_define(HashtablePtr);
|
||||
ktid_define(Hashtable);
|
||||
|
||||
// amount of rows
|
||||
static const uint16 HT_HEIGHTS[]={17,61,257,1021,4099,16381,65521};
|
||||
@@ -96,7 +95,7 @@ Unitype Hashtable_get(Hashtable* ht, char* key){
|
||||
bool Hashtable_try_get(Hashtable* ht, char* key, Unitype* output){
|
||||
Unitype u=Hashtable_get(ht,key);
|
||||
*output=u;
|
||||
return u.typeId!=ktId_Null;
|
||||
return u.typeId!=ktid_Null;
|
||||
}
|
||||
|
||||
void Hashtable_addOrSet(Hashtable* ht, char* key, Unitype u){
|
||||
|
||||
@@ -11,8 +11,7 @@ typedef struct Hashtable{
|
||||
uint8 hein; // height=HT_HEIGHTS[hein]
|
||||
Autoarr(KVPair)** rows; // Autoarr[height]
|
||||
} Hashtable;
|
||||
ktId_declare(Hashtable);
|
||||
ktId_declare(HashtablePtr);
|
||||
ktid_declare(Hashtable);
|
||||
|
||||
Hashtable* Hashtable_create();
|
||||
void Hashtable_free(Hashtable* ht);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#include "KeyValuePair.h"
|
||||
|
||||
ktId_define(KVPair);
|
||||
ktId_define(KVPairPtr);
|
||||
ktid_define(KVPair);
|
||||
|
||||
Autoarr_define(KVPair)
|
||||
ktId_define(AutoarrKVPair);
|
||||
ktId_define(AutoarrKVPairPtr);
|
||||
|
||||
// proper way to clear a KVP
|
||||
void KVPair_free(KVPair p){
|
||||
|
||||
@@ -11,12 +11,9 @@ typedef struct KVPair{
|
||||
char* key;
|
||||
Unitype value;
|
||||
} KVPair;
|
||||
ktId_declare(KVPair);
|
||||
ktId_declare(KVPairPtr);
|
||||
ktid_declare(KVPair);
|
||||
|
||||
Autoarr_declare(KVPair)
|
||||
ktId_declare(AutoarrKVPair);
|
||||
ktId_declare(AutoarrKVPairPtr);
|
||||
|
||||
// proper way to clear a KVP
|
||||
void KVPair_free(KVPair p);
|
||||
|
||||
Reference in New Issue
Block a user