case PERL_MAGIC_tied:
case PERL_MAGIC_sig:
*needs_store = FALSE;
+ return; /* We've set all there is to set. */
}
}
mg = mg->mg_moremagic;
/*PerlIO_printf(PerlIO_stderr(), "hsplit called for %p which had %d\n",
hv, (int) oldsize);*/
- if (HvPLACEHOLDERS(hv) && !SvREADONLY(hv)) {
+ if (HvPLACEHOLDERS_get(hv) && !SvREADONLY(hv)) {
/* Can make this clear any placeholders first for non-restricted hashes,
even though Storable rebuilds restricted hashes by putting in all the
placeholders (first) before turning on the readonly flag, because
Perl_hv_clear_placeholders(pTHX_ HV *hv)
{
dVAR;
- I32 items = (I32)HvPLACEHOLDERS(hv);
+ I32 items = (I32)HvPLACEHOLDERS_get(hv);
I32 i = HvMAX(hv);
if (items == 0)
if (--items == 0) {
/* Finished. */
- HvTOTALKEYS(hv) -= (IV)HvPLACEHOLDERS(hv);
+ HvTOTALKEYS(hv) -= (IV)HvPLACEHOLDERS_get(hv);
if (HvKEYS(hv) == 0)
HvHASKFLAGS_off(hv);
- HvPLACEHOLDERS(hv) = 0;
+ HvPLACEHOLDERS_set(hv, 0);
return;
}
} else {
}
/* used to be xhv->xhv_fill before 5.004_65 */
- return XHvTOTALKEYS(xhv);
+ return HvTOTALKEYS(hv);
}
I32 *
register XPVHV* xhv;
register HE *entry;
register HE **oentry;
- register I32 i = 1;
+ HE **first;
bool found = 0;
bool is_utf8 = FALSE;
int k_flags = 0;
xhv = (XPVHV*)SvANY(PL_strtab);
/* assert(xhv_array != 0) */
LOCK_STRTAB_MUTEX;
- oentry = &(HvARRAY(PL_strtab))[hash & (I32) HvMAX(PL_strtab)];
+ first = oentry = &(HvARRAY(PL_strtab))[hash & (I32) HvMAX(PL_strtab)];
if (hek) {
- for (entry = *oentry; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) {
+ for (entry = *oentry; entry; oentry = &HeNEXT(entry), entry = *oentry) {
if (HeKEY_hek(entry) != hek)
continue;
found = 1;
}
} else {
const int flags_masked = k_flags & HVhek_MASK;
- for (entry = *oentry; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) {
+ for (entry = *oentry; entry; oentry = &HeNEXT(entry), entry = *oentry) {
if (HeHASH(entry) != hash) /* strings can't be equal */
continue;
if (HeKLEN(entry) != len)
if (found) {
if (--HeVAL(entry) == Nullsv) {
*oentry = HeNEXT(entry);
- if (i && !*oentry)
+ if (!*first) {
+ /* There are now no entries in our slot. */
xhv->xhv_fill--; /* HvFILL(hv)-- */
+ }
Safefree(HeKEY_hek(entry));
del_HE(entry);
xhv->xhv_keys--; /* HvKEYS(hv)-- */
register XPVHV* xhv;
register HE *entry;
register HE **oentry;
- register I32 i = 1;
I32 found = 0;
const int flags_masked = flags & HVhek_MASK;
/* assert(xhv_array != 0) */
LOCK_STRTAB_MUTEX;
oentry = &(HvARRAY(PL_strtab))[hash & (I32) HvMAX(PL_strtab)];
- for (entry = *oentry; entry; i=0, entry = HeNEXT(entry)) {
+ for (entry = *oentry; entry; entry = HeNEXT(entry)) {
if (HeHASH(entry) != hash) /* strings can't be equal */
continue;
if (HeKLEN(entry) != len)
break;
}
if (!found) {
+ /* What used to be head of the list.
+ If this is NULL, then we're the first entry for this slot, which
+ means we need to increate fill. */
+ const HE *old_first = *oentry;
entry = new_HE();
HeKEY_hek(entry) = save_hek_flags(str, len, hash, flags_masked);
HeVAL(entry) = Nullsv;
HeNEXT(entry) = *oentry;
*oentry = entry;
xhv->xhv_keys++; /* HvKEYS(hv)++ */
- if (i) { /* initial entry? */
+ if (!old_first) { /* initial entry? */
xhv->xhv_fill++; /* HvFILL(hv)++ */
} else if (xhv->xhv_keys > (IV)xhv->xhv_max /* HvKEYS(hv) > HvMAX(hv) */) {
hsplit(PL_strtab);
(int) real, (int) HvUSEDKEYS(hv));
bad = 1;
}
- if (HvPLACEHOLDERS(hv) != placeholders) {
+ if (HvPLACEHOLDERS_get(hv) != placeholders) {
PerlIO_printf(Perl_debug_log,
"Count %d placeholder(s), but hash reports %d\n",
- (int) placeholders, (int) HvPLACEHOLDERS(hv));
+ (int) placeholders, (int) HvPLACEHOLDERS_get(hv));
bad = 1;
}
}