本文整理汇总了C++中HASH_DEL函数的典型用法代码示例。如果您正苦于以下问题:C++ HASH_DEL函数的具体用法?C++ HASH_DEL怎么用?C++ HASH_DEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HASH_DEL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreePunc
void FreePunc(FcitxPuncState* puncState)
{
puncState->curPunc = NULL;
FcitxPunc* cur;
while (puncState->puncSet) {
cur = puncState->puncSet;
HASH_DEL(puncState->puncSet, cur);
free(cur->langCode);
free(cur->curPunc);
free(cur);
}
}
示例2: delete_file_descriptor_table
void delete_file_descriptor_table(int pid) {
struct file_descriptor_table * table;
table = get_file_descriptor_table(pid);
if (table) {
HASH_DEL(file_descriptor_tables, table);
free(table->entries);
free(table);
}
}
示例3: consolidate_gsub_single
bool consolidate_gsub_single(caryll_font *font, table_otl *table, otl_subtable *_subtable,
sds lookupName) {
subtable_gsub_single *subtable = &(_subtable->gsub_single);
consolidate_coverage(font, subtable->from, lookupName);
consolidate_coverage(font, subtable->to, lookupName);
uint16_t len =
(subtable->from->numGlyphs < subtable->to->numGlyphs ? subtable->from->numGlyphs
: subtable->from->numGlyphs);
gsub_single_map_hash *h = NULL;
for (uint16_t k = 0; k < len; k++) {
if (subtable->from->glyphs[k].name && subtable->to->glyphs[k].name) {
gsub_single_map_hash *s;
int fromid = subtable->from->glyphs[k].gid;
HASH_FIND_INT(h, &fromid, s);
if (s) {
fprintf(stderr, "[Consolidate] Double-mapping a glyph in a "
"single substitution /%s.\n",
subtable->from->glyphs[k].name);
} else {
NEW(s);
s->fromid = subtable->from->glyphs[k].gid;
s->toid = subtable->to->glyphs[k].gid;
s->fromname = subtable->from->glyphs[k].name;
s->toname = subtable->to->glyphs[k].name;
HASH_ADD_INT(h, fromid, s);
}
}
}
HASH_SORT(h, by_from_id);
if (HASH_COUNT(h) != subtable->from->numGlyphs || HASH_COUNT(h) != subtable->to->numGlyphs) {
fprintf(stderr, "[Consolidate] In single subsitution lookup %s, some "
"mappings are ignored.\n",
lookupName);
}
subtable->from->numGlyphs = HASH_COUNT(h);
subtable->to->numGlyphs = HASH_COUNT(h);
FREE(subtable->from->glyphs);
FREE(subtable->to->glyphs);
NEW_N(subtable->from->glyphs, subtable->from->numGlyphs);
NEW_N(subtable->to->glyphs, subtable->to->numGlyphs);
{
gsub_single_map_hash *s, *tmp;
uint16_t j = 0;
HASH_ITER(hh, h, s, tmp) {
subtable->from->glyphs[j].gid = s->fromid;
subtable->from->glyphs[j].name = s->fromname;
subtable->to->glyphs[j].gid = s->toid;
subtable->to->glyphs[j].name = s->toname;
j++;
HASH_DEL(h, s);
free(s);
}
}
示例4: cache_destroy
/* when an object is deleted */
void cache_destroy(struct giga_directory *dir)
{
assert(dir->refcount > 1);
/* once to release from the caller */
__sync_fetch_and_sub(&dir->refcount, 1);
HASH_DEL(dircache, dir);
if (__sync_sub_and_fetch(&dir->refcount, 1) == 0)
free(dir);
}
示例5: augroup_remove
void augroup_remove(char *key)
{
log_msg("HOOK", "GROUP REMOVE");
Augroup *find;
HASH_FIND_STR(aug_tbl, key, find);
if (!find)
return;
HASH_DEL(aug_tbl, find);
free(find->key);
free(find);
}
示例6: UnloadSingleImage
void UnloadSingleImage(FcitxSkin* sc, const char* name)
{
SkinImage *image;
HASH_FIND_STR(sc->imageTable, name, image);
if (image != NULL) {
SkinImage* curimage = image;
HASH_DEL(sc->imageTable, image);
free(curimage->name);
cairo_surface_destroy(curimage->image);
free(curimage);
}
}
示例7: delete_all
void
delete_all ()
{
User *current_user;
while (users)
{
current_user = users; /* grab pointer to first item */
HASH_DEL (users, current_user); /* delete it (users advances to next) */
free (current_user); /* free it */
}
}
示例8: rel_delete
void rel_delete(rel_hash *r)
{
printf("\n<-- delete a rel node -->\n");
if(r)
{
pthread_mutex_lock(&rq->node[r->loc].mutex);
rq->node[r->loc].isDelete = 1;
pthread_mutex_unlock(&rq->node[r->loc].mutex);
HASH_DEL(rhs, r);
free(r);
}
}
示例9: delete_proc_hash
void delete_proc_hash(mem_proc_t *mem_proc)
{
//HASH_CLEAR(hh, mem_proc);
mem_proc_t *tmp_mem, *cur_mem;
HASH_ITER(hh, mem_proc, cur_mem, tmp_mem) {
if(mem_proc != cur_mem)
HASH_DEL(mem_proc, cur_mem);
if(cur_mem) free(cur_mem);
}
//if(mem_proc) free(mem_proc);
}
示例10: hash_del_queue
/* Delete specify queue by queue name from hash table */
void hash_del_queue(const char* qname)
{
mq_queue_list_t* tmp_queue = NULL;
HASH_FIND_STR(g_mq_qlist, qname, tmp_queue);
if (tmp_queue != NULL)
{
log_debug("Del queue [%s]\n", tmp_queue->qname);
HASH_DEL(g_mq_qlist, tmp_queue); /* user: pointer to deletee */
free(tmp_queue); /* optional; it��s up to you! */
}
}
示例11: UnloadImage
void UnloadImage(FcitxSkin* skin)
{
SkinImage *images = skin->imageTable;
while (images) {
SkinImage* curimage = images;
HASH_DEL(images, curimage);
free(curimage->name);
cairo_surface_destroy(curimage->image);
free(curimage);
}
skin->imageTable = NULL;
}
示例12: send_tc
dessert_per_result_t send_tc(void *data, struct timeval *scheduled, struct timeval *interval) {
pthread_rwlock_wrlock(&pp_rwlock);
if (HASH_COUNT(dir_neighbors_head) == 0) {
return 0;
}
dessert_msg_t *tc;
dessert_msg_new(&tc);
tc->ttl = TTL_MAX;
tc->u8 = ++tc_seq_nr;
// delete old entries from NH list
node_neighbors_t *dir_neigh = dir_neighbors_head;
while (dir_neigh) {
if (dir_neigh->entry_age-- == 0) {
node_neighbors_t* el_to_delete = dir_neigh;
HASH_DEL(dir_neighbors_head, el_to_delete);
free(el_to_delete);
}
dir_neigh = dir_neigh->hh.next;
}
// add TC extension
dessert_ext_t *ext;
uint8_t ext_size = 1 + ((sizeof(node_neighbors_t)- sizeof(dir_neighbors_head->hh)) * HASH_COUNT(dir_neighbors_head));
dessert_msg_addext(tc, &ext, LSR_EXT_TC, ext_size);
void* tc_ext = ext->data;
memcpy(tc_ext, &(ext_size), 1);
tc_ext++;
// copy NH list into extension
dir_neigh = dir_neighbors_head;
while (dir_neigh) {
memcpy(tc_ext, dir_neigh->addr, ETH_ALEN);
tc_ext += ETH_ALEN;
memcpy(tc_ext, &(dir_neigh->entry_age), 1);
tc_ext++;
memcpy(tc_ext, &(dir_neigh->weight), 1);
tc_ext++;
dir_neigh = dir_neigh->hh.next;
}
// add l2.5 header
dessert_msg_addext(tc, &ext, DESSERT_EXT_ETH, ETHER_HDR_LEN);
struct ether_header* l25h = (struct ether_header*) ext->data;
memcpy(l25h->ether_shost, dessert_l25_defsrc, ETH_ALEN);
memcpy(l25h->ether_dhost, ether_broadcast, ETH_ALEN);
dessert_meshsend_fast(tc, NULL);
dessert_msg_destroy(tc);
pthread_rwlock_unlock(&pp_rwlock);
return 0;
}
示例13: __AI_correlation_table_cleanup
PRIVATE void
__AI_correlation_table_cleanup ()
{
AI_alert_correlation *current;
while ( correlation_table )
{
current = correlation_table;
HASH_DEL ( correlation_table, current );
free ( current );
}
} /* ----- end of function __AI_correlation_table_cleanup ----- */
示例14: springfield_iter_i
static void springfield_iter_i(springfield_t *r, springfield_iter_cb cb,
springfield_readonly_iter_cb rocb, void *passthrough) {
/* Copy into temporary buffer */
if (cb) {
assert(!rocb);
} else {
assert(rocb);
}
int i;
for (i = 0; i < r->num_buckets; i++) {
uint64_t off = r->offsets[i];
springfield_key_t *key = NULL, *tmp = NULL;
springfield_key_t *keys = NULL;
pthread_rwlock_rdlock(&r->main_lock);
while (off != NO_BACKTRACE) {
springfield_header_v1 *h = (springfield_header_v1 *)(r->map + off);
int klen = h->klen - 1;
char *keyptr = (char *)(r->map + off + HEADER_SIZE);
HASH_FIND(hh, keys, keyptr, klen, key);
uint64_t last = h->last;
if (!key) {
/* not found */
key = calloc(1, sizeof(springfield_key_t));
key->key = strdup(keyptr);
int do_callback = h->vlen > 0;
if (do_callback) {
if (cb) {
pthread_rwlock_unlock(&r->main_lock);
cb(r, key->key, passthrough);
pthread_rwlock_rdlock(&r->main_lock);
} else {
pthread_rwlock_unlock(&r->main_lock);
rocb(r, key->key,
r->map + off + HEADER_SIZE + h->klen,
h->vlen, passthrough);
pthread_rwlock_rdlock(&r->main_lock);
}
}
/* set in hash */
HASH_ADD_KEYPTR(hh, keys, key->key, klen, key);
}
off = last;
}
pthread_rwlock_unlock(&r->main_lock);
/* cleanup keys XXX */
HASH_ITER(hh, keys, key, tmp) {
HASH_DEL(keys, key);
free(key->key);
free(key);
}
}
示例15: cluster_trim
/**
* Trim a clustering by rejecting small clusters. The provided clustering
* structure is updated by assigning reports of rejected clusters to the
* cluster label 0.
* @param c Clustering structure
*/
void cluster_trim(cluster_t *c)
{
assert(c);
count_t *counts = NULL, *entry;
unsigned int i, j;
int rej;
config_lookup_int(&cfg, "cluster.reject_num", &rej);
for (i = 0; i < c->len; i++) {
/* Look for cluster in hash table */
HASH_FIND_INT(counts, &(c->cluster[i]), entry);
if (!entry) {
entry = malloc(sizeof(count_t));
if (!entry) {
error("Could not allocate cluster bin");
return;
}
/* Create new entry */
entry->label = c->cluster[i];
entry->count = 0;
/* Add entry */
HASH_ADD_INT(counts, label, entry);
}
entry->count++;
}
/* Update cluster assignments */
for (i = 0; i < c->len; i++) {
/* Look for cluster in hash table */
HASH_FIND_INT(counts, &(c->cluster[i]), entry);
if (entry->count >= rej)
c->cluster[i] = entry->label;
else
c->cluster[i] = 0;
}
/* Delete hash table */
for (j = 0; counts;) {
/* Count rejected clusters */
entry = counts;
if (entry->count < rej)
j++;
HASH_DEL(counts, entry);
free(entry);
}
/* Correct cluster number */
c->num -= j;
}