bool hash_add(hash_table *table, tc_pool_t *pool, uint64_t key, void *data) { hash_node *hn, *tmp; link_list *l; p_link_node ln; ln = hash_find_node(table, key); if (ln == NULL) { tmp = hash_node_malloc(pool, key, data); if (tmp != NULL) { l = get_link_list(table, key); ln = link_node_malloc(pool, tmp); if (ln != NULL) { link_list_push(l, ln); table->total++; return true; } else { return false; } } else { return false; } } else { hn = (hash_node *) ln->data; hn->data = data; return false; } }
void * hash_find(hash_table *table,uint64_t key){ hash_node *hnode=NULL; lnodeptr node = hash_find_node(table,key); if(node != NULL){ hnode = (hash_node *) node->data; return hnode->data; } return NULL; }
void *hash_find(hash_table *table, uint64_t key) { hash_node *hn; p_link_node ln = hash_find_node(table, key); if(ln != NULL){ hn = (hash_node *) ln->data; return hn->data; } return NULL; }
void hash_del(hash_table *table,uint64_t key){ lnodeptr node = hash_find_node(table,key); if(node != NULL){ linklist_remove(node); if(node->data!=NULL) { free(node->data); } node->data=NULL; lnode_free(node); } return; }
bool hash_del(hash_table *table, uint64_t key) { link_list *l = get_link_list(table, key); p_link_node ln = hash_find_node(table, key); if(ln != NULL){ table->total--; link_list_remove(l, ln); link_node_internal_free(ln); free(ln); return true; }else{ return false; } }
bool hash_del(hash_table *table, tc_pool_t *pool, uint64_t key) { link_list *l = get_link_list(table, key); p_link_node ln = hash_find_node(table, key); if (ln != NULL) { table->total--; link_list_remove(l, ln); tc_pfree(pool, ln->data); tc_pfree(pool, ln); return true; } else { return false; } }
void hash_add(hash_table *table,uint64_t key,void *data){ hash_node *hnode = NULL; hash_node *newnode =NULL; lnodeptr pnode = NULL; linklist *l = NULL; lnodeptr node = hash_find_node(table,key); if(node != NULL){ hnode = (hash_node *) node->data; hnode->data = data; }else { newnode = hash_node_malloc(key,data); pnode = lnode_malloc(newnode); l = get_linklist(table,key); linklist_push(l,pnode); } }