本文整理汇总了C++中HASH_DEL函数的典型用法代码示例。如果您正苦于以下问题:C++ HASH_DEL函数的具体用法?C++ HASH_DEL怎么用?C++ HASH_DEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HASH_DEL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:adaptee,项目名称:fcitx,代码行数:12,代码来源:punc.c
示例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);
}
}
开发者ID:gitanuj,项目名称:fstr,代码行数:12,代码来源:syscalls2.c
示例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);
}
}
开发者ID:gitter-badger,项目名称:otfcc,代码行数:53,代码来源:gsub-single.c
示例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);
}
开发者ID:kair,项目名称:mds_scaling,代码行数:13,代码来源:cache.c
示例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);
}
开发者ID:jollywho,项目名称:nav,代码行数:12,代码来源:hook.c
示例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);
}
}
开发者ID:niubenben,项目名称:fcitx,代码行数:12,代码来源:skin.c
示例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 */
}
}
开发者ID:bugcy013,项目名称:pgstatmib,代码行数:12,代码来源:example2.c
示例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);
}
}
开发者ID:lsylsy2,项目名称:DeltaCFS,代码行数:12,代码来源:syncrelation.c
示例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);
}
开发者ID:kyuhlee,项目名称:UBSI,代码行数:12,代码来源:audisp-example.c
示例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! */
}
}
开发者ID:bigtreetree,项目名称:ucmq,代码行数:13,代码来源:mq_queue_manage.c
示例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;
}
开发者ID:niubenben,项目名称:fcitx,代码行数:12,代码来源:skin.c
示例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;
}
开发者ID:Dekue,项目名称:des-routing-algorithms,代码行数:53,代码来源:des-lsr_routinglogic.c
示例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 ----- */
开发者ID:BlackLight,项目名称:Snort_AIPreproc,代码行数:12,代码来源:correlation.c
示例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);
}
}
开发者ID:jamwt,项目名称:springfield,代码行数:52,代码来源:springfield.c
示例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;
}
开发者ID:JaonLin,项目名称:malheur,代码行数:58,代码来源:cluster.c
示例16: matchInodefiles
int matchInodefiles(void) {
fileop_t *f;
fileop_t *finode;
char fpath[PATH_MAX];
struct stat st;
int64_t inode;
// first try to match inodefiles to files
for (f = files; f != NULL; f = (fileop_t*) (f->hh.next)) {
// get ino of the file
getAbsolutePath(fpath, config.snapshot, f->relpath);
if (stat(fpath, &st) != -1) {
inode = st.st_ino;
} else {
// this should not happen: we can't open the file
errMsg(LOG_WARNING, "Could not stat file %s ", fpath);
}
// if this ino is in inodefiles, merge the operations in f and
// remove the element from inodefiles
// TODO: what about order?
HASH_FIND_INT(inodefiles, &inode, finode);
if (finode != NULL) {
if (mergeOperations(f, finode) != 0)
return -1;
free(finode->operations);
HASH_DEL(inodefiles, finode);
free(finode);
}
// if there are no entries in inodefiles left, we are done
if (HASH_COUNT(inodefiles) == 0) // HASH_COUNT is cheap
return 0;
}
// the rest must be matched by file tree walk (nftw)
int flags = 0;
flags |= FTW_MOUNT; // stay in the file system
flags |= FTW_PHYS; // do not dereference symlinks
if (nftw(config.snapshot, matchInode, 10, flags) == -1) {
errMsg(LOG_WARNING, "Could not stat file %s ", fpath);
}
// if there are still some entries left in inodefiles, we have a problem
if (HASH_COUNT(inodefiles) == 0)
return 0;
else
return -1;
}
开发者ID:lukasfrelich,项目名称:syncedfs,代码行数:52,代码来源:client.c
示例17: __AI_get_alerts_heterogeneity
double
__AI_get_alerts_heterogeneity ( int *alert_count )
{
double heterogeneity = 0.0;
int distinct_count = 0;
AI_hyperalert_key key;
AI_snort_alert *alert_iterator = NULL;
AI_alert_occurrence *table = NULL,
*found = NULL;
*alert_count = 0;
for ( alert_iterator = alert_log; alert_iterator; alert_iterator = alert_iterator->next )
{
found = NULL;
*alert_count += alert_iterator->grouped_alerts_count;
key.gid = alert_iterator->gid;
key.sid = alert_iterator->sid;
key.rev = alert_iterator->rev;
HASH_FIND ( hh, table, &key, sizeof ( AI_hyperalert_key ), found );
if ( !found )
{
if ( !( found = (AI_alert_occurrence*) malloc ( sizeof ( AI_alert_occurrence ))))
AI_fatal_err ( "Fatal dynamic memory allocation error", __FILE__, __LINE__ );
found->key = key;
found->count = 1;
HASH_ADD ( hh, table, key, sizeof ( AI_hyperalert_key ), found );
} else {
found->count++;
}
}
for ( found = table; found; found = (AI_alert_occurrence*) found->hh.next )
distinct_count++;
if ( *alert_count > 0 )
heterogeneity = (double) distinct_count / (double) *alert_count;
else
heterogeneity = 0.0;
while ( table )
{
found = table;
HASH_DEL ( table, found );
free ( found );
}
return heterogeneity;
} /* ----- end of function __AI_get_alerts_heterogeneity ----- */
开发者ID:BlackLight,项目名称:Snort_AIPreproc,代码行数:52,代码来源:cluster.c
示例18: MAT_PARSER_free
void MAT_PARSER_free(Parser* p) {
// Local variables
MAT_Parser* parser = (MAT_Parser*)PARSER_get_data(p);
// No parser
if (!parser)
return;
// Buses
while (parser->bus_hash)
HASH_DEL(parser->bus_hash,parser->bus_hash);
LIST_map(MAT_Bus,parser->bus_list,bus,next,{free(bus);});
开发者ID:entriken,项目名称:PFNET,代码行数:13,代码来源:parser_MAT.c
示例19: free_var_hash
/* Deallocate variable hash. */
static void
free_var_hash (struct id_defined *head)
{
struct id_defined *el, *tmp;
HASH_ITER (hh, head, el, tmp)
{
struct tree_hash_node *hel, *tmp;
if (el->phi_node)
HASH_FREE (hh, el->phi_node, hel, tmp);
HASH_DEL (head, el);
free (el);
}
}
开发者ID:zayac,项目名称:eq,代码行数:14,代码来源:controlflow.c
示例20: resetSeqLog
void resetSeqLog() {
seqlog_t* current;
pthread_rwlock_wrlock(&seqlog_lock);
while(seqlog) {
current = seqlog;
HASH_DEL(seqlog, current);
free(current);
}
pthread_rwlock_unlock(&seqlog_lock);
dessert_notice("sequence number log flushed");
}
开发者ID:Dekue,项目名称:des-routing-algorithms,代码行数:13,代码来源:gossiping_packettrap.c
注:本文中的HASH_DEL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论