MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_htable_reset

Function acl_htable_reset

lib_acl/src/stdlib/common/acl_htable.c:1003–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001}
1002
1003int acl_htable_reset(ACL_HTABLE *table, void (*free_fn) (void *))
1004{
1005 unsigned i = table->size;
1006 ACL_HTABLE_INFO *ht;
1007 ACL_HTABLE_INFO *next;
1008 ACL_HTABLE_INFO **h;
1009 int ret;
1010
1011 LOCK_TABLE_WRITE(table);
1012
1013 h = table->data;
1014
1015 while (i-- > 0) {
1016 for (ht = *h++; ht; ht = next) {
1017 next = ht->next;
1018 if (!(table->flag & ACL_HTABLE_FLAG_KEY_REUSE)) {
1019 if (table->slice) {
1020 acl_slice_pool_free(__FILE__, __LINE__,
1021 ht->key.key);
1022 } else {
1023 acl_myfree(ht->key.key);
1024 }
1025 }
1026
1027 if (free_fn && ht->value) {
1028 (*free_fn) (ht->value);
1029 }
1030
1031 if (table->slice) {
1032 acl_slice_pool_free(__FILE__, __LINE__, ht);
1033 } else {
1034 acl_myfree(ht);
1035 }
1036 }
1037 }
1038
1039 if (table->slice) {
1040 acl_slice_pool_free(__FILE__, __LINE__, table->data);
1041 } else {
1042 acl_myfree(table->data);
1043 }
1044
1045 ret = htable_size(table, table->init_size < 13 ? 13 : table->init_size);
1046
1047 UNLOCK_TABLE(table);
1048 return ret;
1049}
1050
1051const ACL_HTABLE_INFO *acl_htable_iter_head(ACL_HTABLE *table, ACL_HTABLE_ITER *iter)
1052{

Callers 4

acl_xml_resetFunction · 0.85
acl_xml3_resetFunction · 0.85
acl_xml2_resetFunction · 0.85
__hdr_resetFunction · 0.85

Calls 4

LOCK_TABLE_WRITEFunction · 0.85
acl_slice_pool_freeFunction · 0.85
UNLOCK_TABLEFunction · 0.85
htable_sizeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…