#include "ptable.h"
#define ptable_store(T, K, V) ptable_store(aTHX_ (T), (K), (V))
-#define ptable_delete(T, K) ptable_delete(aTHX_ (T), (K))
#define ptable_clear(T) ptable_clear(aTHX_ (T))
#define ptable_free(T) ptable_free(aTHX_ (T))
#define indirect_map_delete(O) indirect_map_delete(aTHX_ (O))
dMY_CXT;
- ptable_delete(MY_CXT.map, o);
+ ptable_store(MY_CXT.map, o, NULL);
}
/* --- Check functions ----------------------------------------------------- */
}
#endif /* !ptable_fetch */
-STATIC void PTABLE_PREFIX(_delete)(pPTBL_ const ptable * const t, const void * const key) {
- ptable_ent *const ent = ptable_find(t, key);
-
- if (ent) {
- void *val = ent->val;
- PTABLE_VAL_FREE(val);
- ent->val = NULL;
- }
-}
-
#ifndef ptable_split
STATIC void ptable_split(pPTBLMS_ ptable * const t) {
#define ptable_split(T) ptable_split(aPTBLMS_ (T))
void *oldval = ent->val;
PTABLE_VAL_FREE(oldval);
ent->val = val;
- } else {
+ } else if (val) {
const UV i = PTABLE_HASH(key) & t->max;
ent = PerlMemShared_malloc(sizeof *ent);
ent->key = key;