continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
return &HeVAL(entry);
}
xhv = (XPVHV*)SvANY(hv);
if (SvRMAGICAL(hv) && mg_find((SV*)hv,'P')) {
- if (!(entry = xhv->xhv_eiter)) {
- xhv->xhv_eiter = entry = new_he(); /* only one HE per MAGICAL hash */
- Zero(entry, 1, HE);
- HeKLEN(entry) = HEf_SVKEY; /* hent_key is holding an SV* */
- }
- else if ((sv = HeSVKEY(entry)))
- SvREFCNT_dec(sv);
sv = sv_newmortal();
mg_copy((SV*)hv, sv, (char*)keysv, HEf_SVKEY);
+ entry = &He;
HeVAL(entry) = sv;
- HeKEY(entry) = (char*)SvREFCNT_inc(keysv);
+ HeKEY(entry) = (char*)keysv;
+ HeKLEN(entry) = HEf_SVKEY; /* hent_key is holding an SV* */
return entry;
}
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
return entry;
}
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
SvREFCNT_dec(HeVAL(entry));
HeVAL(entry) = val;
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
SvREFCNT_dec(HeVAL(entry));
HeVAL(entry) = val;
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
*oentry = HeNEXT(entry);
if (i && !*oentry)
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
*oentry = HeNEXT(entry);
if (i && !*oentry)
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
return TRUE;
}
continue;
if (HeKLEN(entry) != klen)
continue;
- if (bcmp(HeKEY(entry),key,klen)) /* is this it? */
+ if (memcmp(HeKEY(entry),key,klen)) /* is this it? */
continue;
return TRUE;
}
if (SvRMAGICAL(hv) && (mg = mg_find((SV*)hv,'P'))) {
SV *key = sv_newmortal();
- if (entry)
+ if (entry) {
sv_setsv(key, HeSVKEY_force(entry));
+ SvREFCNT_dec(HeSVKEY(entry)); /* get rid of previous key */
+ }
else {
- xhv->xhv_eiter = entry = new_he(); /* only one HE per MAGICAL hash */
+ xhv->xhv_eiter = entry = new_he(); /* only one HE per MAGICAL hash */
Zero(entry, 1, HE);
HeKLEN(entry) = HEf_SVKEY;
}
magic_nextpack((SV*) hv,mg,key);
if (SvOK(key)) {
- SvREFCNT_dec(HeSVKEY(entry));
+ /* force key to stay around until next time */
HeKEY(entry) = (char*)SvREFCNT_inc(key);
return entry; /* beware, hent_val is not set */
}
continue;
if (HeKLEN(entry) != len)
continue;
- if (bcmp(HeKEY(entry),str,len)) /* is this it? */
+ if (memcmp(HeKEY(entry),str,len)) /* is this it? */
continue;
found = 1;
break;
continue;
if (HeKLEN(entry) != len)
continue;
- if (bcmp(HeKEY(entry),str,len)) /* is this it? */
+ if (memcmp(HeKEY(entry),str,len)) /* is this it? */
continue;
found = 1;
if (--HeVAL(entry) == Nullsv) {