Hi, this is a snippet from modperl_util.c:modperl_pnotes()
if (key) {
STRLEN len;
char *k = SvPV(key, len);
if (val) {
retval = *hv_store(*pnotes, k, len, SvREFCNT_inc(val), 0);
}
else if (hv_exists(*pnotes, k, len)) {
retval = *hv_fetch(*pnotes, k, len, FALSE);
}
}
else {
retval = newRV_inc((SV *)*pnotes);
}
return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
I am wondering whether the REFCNT is always right. *pnotes is a HV. If the
function is called without a key argument the else branch newRV_inc
increments the REFCNT of the HV, right? Then the return statement in the last
line increments it again? Am I wrong?
Torsten
pgpqvSTjJx3f8.pgp
Description: PGP signature
