| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef __LANGUAGE_HASHMAP_H
- #define __LANGUAGE_HASHMAP_H
- #define MAX_LEN 1024
- #define DELIMITER "|"
- enum {
- HASH_OK=0,
- HASH_REPEAT=-1,
- HASH_OVERFLOW=-2,
- HASH_MALLOC_FAIL=-3,
- };
- typedef struct HashEntry
- {
- char *key;
- char **value;
- int valueLength;
- struct HashEntry *next;
- } HashEntry;
- typedef struct HashTable
- {
- HashEntry **ptable;
- int size;
- } HashTable;
- unsigned int _hash(HashTable *table,const char *key) ;
- HashTable *create_hash_table(int size);
-
- // 在哈希表中插入键值对
- int insert_Newhash(HashTable *table, const char *key, const char **value,int valuelens);
-
- // 在哈希表中查找键对应的值
- const HashEntry*find_hash(HashTable *table, const char *key);
-
- // 释放哈希表占用的内存
- void free_hash_table(HashTable *table);
- // 替换管包裹字符
- void replace_sequences(char *str, HashTable *table);
- int init_hash_table(void);
- #endif
|