void flow_cleanup (void) { if (ipv4_hash_table != NULL) { HT_destroy (ipv4_hash_table); } if (ipv6_hash_table != NULL) { HT_destroy (ipv6_hash_table); } ipv4_hash_table = NULL; ipv6_hash_table = NULL; }
int destroyGraph(ptr_graph graph) { HT_destroy(graph->table,destroy_entry); //int epistrofh h HT_destroy free(graph); return 0; }
void ipv4_reassembly_cleanup(void) { struct reassembly_desc *node_data = NULL; uint8_t *node_key = NULL; if (hash_table == NULL) return; /* no action */ while ((node_key = HT_first_key(hash_table)) != NULL) { /* while any node exists */ if ((node_data = HT_read(hash_table, node_key)) != NULL) free(node_data->buffer); HT_delete(hash_table, node_key); } HT_destroy(hash_table); hash_table = NULL; }
static void keyword_map(pTHX_ HashTable *current, SV *sv, SV **rval) { HashTable keyword_map = NULL; if(sv) { if (SvROK(sv)) { sv = SvRV(sv); if (SvTYPE(sv) == SVt_PVHV) { HV *hv = (HV *) sv; HE *entry; keyword_map = HT_new_ex(4, HT_AUTOGROW); (void) hv_iterinit(hv); while ((entry = hv_iternext(hv)) != NULL) { SV *value; I32 keylen; const char *key, *c; const CKeywordToken *pTok; c = key = hv_iterkey(entry, &keylen); if (*c == '\0') FAIL_CLEAN((aTHX_ "Cannot use empty string as a keyword")); while (*c == '_' || isALPHA(*c)) c++; if (*c != '\0') FAIL_CLEAN((aTHX_ "Cannot use '%s' as a keyword", key)); value = hv_iterval(hv, entry); if (!SvOK(value)) pTok = get_skip_token(); else { const char *map; if (SvROK(value)) FAIL_CLEAN((aTHX_ "Cannot use a reference as a keyword")); map = SvPV_nolen(value); if ((pTok = get_c_keyword_token(map)) == NULL) FAIL_CLEAN((aTHX_ "Cannot use '%s' as a keyword", map)); } (void) HT_store(keyword_map, key, (int) keylen, 0, (CKeywordToken *) pTok); } if (current != NULL) { HT_destroy(*current, NULL); *current = keyword_map; } } else Perl_croak(aTHX_ "KeywordMap wants a hash reference"); } else Perl_croak(aTHX_ "KeywordMap wants a hash reference"); } if (rval) { HashIterator hi; HV *hv = newHV(); CKeywordToken *tok; const char *key; int keylen; HI_init(&hi, *current); while (HI_next(&hi, &key, &keylen, (void **) &tok)) { SV *val; val = tok->name == NULL ? newSV(0) : newSVpv(CONST_CHAR(tok->name), 0); if (hv_store(hv, key, keylen, val, 0) == NULL) SvREFCNT_dec(val); } *rval = newRV_noinc((SV *) hv); } }