add type string_t

pull/37/head
yuqing 2017-07-04 10:39:49 +08:00
parent b665626818
commit 0aa66e2823
3 changed files with 8 additions and 1 deletions

View File

@ -169,6 +169,12 @@ typedef struct
int length; int length;
} BufferInfo; } BufferInfo;
typedef struct
{
char *str;
int len;
} string_t;
typedef void (*FreeDataFunc)(void *ptr); typedef void (*FreeDataFunc)(void *ptr);
typedef int (*CompareFunc)(void *p1, void *p2); typedef int (*CompareFunc)(void *p1, void *p2);
typedef void* (*MallocFunc)(size_t size); typedef void* (*MallocFunc)(size_t size);

View File

@ -137,6 +137,7 @@ int hash_set_locks(HashArray *pHash, const int lock_count)
return EINVAL; return EINVAL;
} }
//do NOT support rehash
if (pHash->load_factor >= 0.10) if (pHash->load_factor >= 0.10)
{ {
return EINVAL; return EINVAL;

View File

@ -103,7 +103,7 @@ typedef int (*HashWalkFunc)(const int index, const HashData *data, void *args);
* pHash: the hash table * pHash: the hash table
* hash_func: hash function * hash_func: hash function
* capacity: init capacity * capacity: init capacity
* load_factor: hash load factor, such as 0.75 * load_factor: hash load factor (or watermark), >= 0.10 for auto rehash. eg. 0.75
* max_bytes: max memory can be used (bytes) * max_bytes: max memory can be used (bytes)
* bMallocValue: if need malloc value buffer * bMallocValue: if need malloc value buffer
* return 0 for success, != 0 for error * return 0 for success, != 0 for error