X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=ptable.h;h=ba275bac8c717523f844034a31336d817820aaaa;hb=8291ef989ac98ee2cb53a6098eed7aa7c3ed0ca8;hp=72be11d4b8ea72c85c1e30d01bccd2f83259acf8;hpb=a21a68b2f726d4002d20fb64677a52f72c520964;p=perl%2Fmodules%2Findirect.git diff --git a/ptable.h b/ptable.h index 72be11d..ba275ba 100644 --- a/ptable.h +++ b/ptable.h @@ -80,7 +80,7 @@ typedef struct ptable { STATIC ptable *ptable_new(pPTBLMS) { #define ptable_new() ptable_new(aPTBLMS) ptable *t = PerlMemShared_malloc(sizeof *t); - t->max = 127; + t->max = 15; t->items = 0; t->ary = PerlMemShared_calloc(t->max + 1, sizeof *t->ary); return t; @@ -117,6 +117,16 @@ STATIC void *ptable_fetch(const ptable * const t, const void * const key) { } #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))