#ifndef PERL_OBJECT
static void hsplit _((HV *hv));
static void hfreeentries _((HV *hv));
-static HE* more_he _((void));
+static void more_he _((void));
#endif
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
new_he(void)
{
HE* he;
- if (PL_he_root) {
- he = PL_he_root;
- PL_he_root = HeNEXT(he);
- return he;
- }
- return more_he();
+ LOCK_SV_MUTEX;
+ if (!PL_he_root)
+ more_he();
+ he = PL_he_root;
+ PL_he_root = HeNEXT(he);
+ UNLOCK_SV_MUTEX;
+ return he;
}
STATIC void
del_he(HE *p)
{
+ LOCK_SV_MUTEX;
HeNEXT(p) = (HE*)PL_he_root;
PL_he_root = p;
+ UNLOCK_SV_MUTEX;
}
-STATIC HE*
+STATIC void
more_he(void)
{
register HE* he;
he++;
}
HeNEXT(he) = 0;
- return new_he();
}
STATIC HEK *
return hv;
#if 0
- if (!SvRMAGICAL(ohv) || !mg_find((SV*)ohv,'P')) {
+ if (! SvTIED_mg((SV*)ohv, 'P')) {
/* Quick way ???*/
}
else
xhv = (XPVHV*)SvANY(hv);
oldentry = entry = xhv->xhv_eiter;
- if (SvRMAGICAL(hv) && (mg = mg_find((SV*)hv,'P'))) {
+ if (mg = SvTIED_mg((SV*)hv, 'P')) {
SV *key = sv_newmortal();
if (entry) {
sv_setsv(key, HeSVKEY_force(entry));
del_he(entry);
--xhv->xhv_keys;
}
- UNLOCK_STRTAB_MUTEX;
break;
}
+ UNLOCK_STRTAB_MUTEX;
if (!found)
warn("Attempt to free non-existent shared string");