void reInitializeBondTable() { if (bondStretchHashtable != NULL) { hashtable_iterate(bondStretchHashtable, clearBondWarnings); } if (bendDataHashtable != NULL) { hashtable_iterate(bendDataHashtable, clearBendWarnings); } }
/** Process a dictionary of enabled DSUI events, given from a * DSUI configuration file, and enable the corresponding * instrumentation points */ static void dsui_process_enable_dict(dsui_stream_t ds, struct hashtable *enabled) { hashtable_itr_t fam_itr = HASH_ITR_INIT; char *fam_name; value_t *val; #if 0 /* FIXME.j - appears to be an unused variable */ hashtable_t family_dict; #endif list_t *pos; while (hashtable_iterate(enabled, &fam_itr, &fam_name, &val)) { list_t *entity_list; if (value_type(val) == BOOLTYPE) { if (as_bool(val)) { entity_list = create_list(); list_t *iplist = dsui_get_ips_byfamily(fam_name); list_for_each(pos, iplist) { struct datastream_ip *ip = pos->item; list_append(entity_list, encap_string(ip->ip->name)); } list_free(iplist); } else { continue; } } else {
list_t *dsui_get_ips_byfamily(char *group) { list_t *elist = create_list(); hashtable_itr_t itr = HASH_ITR_INIT; char *key; struct datastream_ip *ip; km_rdwr_rlock(&dsui_rwlock); while (hashtable_iterate(ip_names, &itr, &key, &ip)) { char *famname = strdup(key); int x = strlen(group); if (x > strlen(key)) goto endloop; if (famname[x] != '/') goto endloop; famname[x] = '\0'; if (!strcmp(group, famname)) { list_append(elist, ip); } endloop: free(famname); } km_rdwr_runlock(&dsui_rwlock); return elist; }
void cache_dump(struct cache *c, int fd, int type) { struct __dump_container tmp = { .fd = fd, .type = type }; hashtable_iterate(c->h, (void *) &tmp, c->ops->dump_step); }
vchan_t* vchans_iterate(hashtable_iterator_t *iter) { return (vchan_t*)hashtable_iterate(NULL, &vchans, iter); }
bool mapping_iterate(const node *mapping, mapping_iterator iterator, void *context) { PRECOND_NONNULL_ELSE_FALSE(mapping, iterator); PRECOND_ELSE_FALSE(MAPPING == node_kind(mapping)); context_adapter adapter = {.iterator.mapping=iterator, .context=context}; return hashtable_iterate(mapping->content.mapping, mapping_iterator_adpater, &adapter); } bool node_equals(const node *one, const node *two) { if(one == two) { return true; } if((NULL == one && NULL != two) || (NULL != one && NULL == two)) { return false; } bool result = node_kind(one) == node_kind(two) && tag_equals(node_name(one), node_name(two)) && node_size(one) == node_size(two); if(!result) { return result; } switch(node_kind(one)) { case DOCUMENT: result &= node_equals(document_root(one), document_root(two)); break; case SCALAR: result &= scalar_equals(one, two); break; case SEQUENCE: result &= sequence_equals(one, two); break; case MAPPING: result &= mapping_equals(one, two); break; case ALIAS: result &= node_equals(alias_target(one), alias_target(two)); break; } return result; } static bool scalar_equals(const node *one, const node *two) { size_t n1 = node_size(one); size_t n2 = node_size(two); if(n1 != n2) { return false; } return memcmp(scalar_value(one), scalar_value(two), n1) == 0; }
void cache_flush(struct cache *c) { hashtable_iterate(c->h, c, do_flush); c->stats.flush++; }
void cache_iterate(struct cache *c, void *data, int (*iterate)(void *data1, void *data2)) { hashtable_iterate(c->h, data, iterate); }