void n_array_map_arg(const tn_array *arr, void (*map_fn) (void *, void *), void *arg) { register size_t i, n; n = arr->items + arr->start_index; for (i = arr->start_index; i < n; i++) map_fn(arr->data[i], arg); }
void build(void* item, xmlNodePtr node, const Mapping* mapping, BUILD_FUNC build_fn) { SETTER_FUNC setter_func = NULL; char* node_name = (char*) node->name; setter_func = map_fn(node_name, mapping); if (build_fn) build_fn(item, node); if (setter_func != NULL) cleanup_after_set(setter_func, item, xmlNodeGetContent(node)); if (node->next == NULL) return; build(item, node->next, mapping, build_fn); }
int n_hash_map_arg(const tn_hash *ht, void (*map_fn) (const char *, void *, void *), void *arg) { register size_t i, n = 0; register struct hash_bucket *tmp; for (i = 0; i < ht->size; i++) { for (tmp = ht->table[i]; tmp != NULL; tmp = tmp->next) { map_fn(tmp->key, tmp->data, arg); n++; } } return n; }