comments with space
This commit is contained in:
@@ -64,7 +64,7 @@ void Hashtable_add(Hashtable* ht, char* key, Unitype u){
|
||||
Hashtable_add_pair(ht,KVPair(key,u));
|
||||
}
|
||||
|
||||
//returns null or pointer to value in hashtable
|
||||
// returns null or pointer to value in hashtable
|
||||
Unitype* Hashtable_getptr(Hashtable* ht, char* key){
|
||||
Autoarr(KeyValuePair)* ar=getrow(ht,key,false);
|
||||
uint32 arlen=Autoarr_length(ar);
|
||||
|
||||
@@ -9,35 +9,35 @@ extern "C" {
|
||||
#include "KeyValuePair.h"
|
||||
|
||||
typedef struct Hashtable{
|
||||
uint8 hein; //height=HT_HEIGHTS[hein]
|
||||
uint8 hein; // height=HT_HEIGHTS[hein]
|
||||
Autoarr(KeyValuePair)* rows; // Autoarr[height]
|
||||
} Hashtable;
|
||||
|
||||
Hashtable* Hashtable_create();
|
||||
void Hashtable_free(Hashtable* ht);
|
||||
|
||||
//amount of rows
|
||||
// amount of rows
|
||||
uint32 Hashtable_height(Hashtable* ht);
|
||||
|
||||
//adds charptr and value to new KeyValuePair
|
||||
//use cptr_copy() to create new string if needed
|
||||
// adds charptr and value to new KeyValuePair
|
||||
// use cptr_copy() to create new string if needed
|
||||
#define KVPair(key,value) (KeyValuePair){key,value}
|
||||
|
||||
//
|
||||
//
|
||||
// don't add pairs with the same keys,
|
||||
// or something weird will happen
|
||||
//
|
||||
//
|
||||
void Hashtable_add_pair(Hashtable* ht, KeyValuePair p);
|
||||
void Hashtable_add(Hashtable* ht, char* key, Unitype u);
|
||||
|
||||
//returns null or pointer to value in hashtable
|
||||
// returns null or pointer to value in hashtable
|
||||
Unitype* Hashtable_getptr(Hashtable* ht, char* key);
|
||||
|
||||
Unitype Hashtable_get(Hashtable* ht, char* key);
|
||||
KeyValuePair Hashtable_get_pair(Hashtable* ht, char* key);
|
||||
bool Hashtable_try_get(Hashtable* ht, char* key, Unitype* output);
|
||||
|
||||
//not implemented yet
|
||||
// not implemented yet
|
||||
void Hashtable_set_pair(Hashtable* ht, KeyValuePair p);
|
||||
void Hashtable_set(Hashtable* ht, char* key, Unitype u);
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
define_Autoarr(KeyValuePair)
|
||||
|
||||
|
||||
//proper way to clear a KVP
|
||||
// proper way to clear a KVP
|
||||
void KeyValuePair_free(KeyValuePair p){
|
||||
free(p.key);
|
||||
Unitype_free(p.value);
|
||||
}
|
||||
|
||||
//func for KVP array clearing
|
||||
// func for KVP array clearing
|
||||
void Autoarr_KeyValuePair_clear(Autoarr_KeyValuePair* ar){
|
||||
for(uint16 blockI=0; blockI < ar->blocks_count-1; blockI++)
|
||||
for(uint16 elemI=0; elemI < ar->max_block_length; elemI++)
|
||||
|
||||
@@ -14,10 +14,10 @@ typedef struct KeyValuePair{
|
||||
|
||||
declare_Autoarr(KeyValuePair)
|
||||
|
||||
//proper way to clear a KVP
|
||||
// proper way to clear a KVP
|
||||
void KeyValuePair_free(KeyValuePair p);
|
||||
|
||||
//func to clear KVP array
|
||||
// func to clear KVP array
|
||||
void Autoarr_KeyValuePair_clear(Autoarr_KeyValuePair* ar);
|
||||
|
||||
void printkvp(KeyValuePair p);
|
||||
|
||||
@@ -6,9 +6,9 @@ extern "C" {
|
||||
|
||||
#include "../base/base.h"
|
||||
|
||||
//djb2 hash function from http://www.cse.yorku.ca/~oz/hash.html
|
||||
// djb2 hash function from http:// www.cse.yorku.ca/~oz/hash.html
|
||||
uint32 ihash(char *str);
|
||||
//sdbm hash function
|
||||
// sdbm hash function
|
||||
uint64 lhash(char* str);
|
||||
|
||||
#if __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user