diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-17 18:09:08 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-12-17 18:09:08 +0000 |
commit | 94f7643d7f26ed53393f1ab3452245da43de285e (patch) | |
tree | 15e7dd66ec0e667152680805ff1a71dcb227d9a1 /hv.c | |
parent | 60e71179391c62fd08759b910342438d90159dc2 (diff) | |
download | perl-94f7643d7f26ed53393f1ab3452245da43de285e.tar.gz |
delete() should return the value as is, not a copy thereof
p4raw-id: //depot/perl@4694
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -502,8 +502,10 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, U32 klen, I32 flags) xhv->xhv_fill--; if (flags & G_DISCARD) sv = Nullsv; - else - sv = sv_mortalcopy(HeVAL(entry)); + else { + sv = HeVAL(entry); + HeVAL(entry) = &PL_sv_undef; + } if (entry == xhv->xhv_eiter) HvLAZYDEL_on(hv); else @@ -576,8 +578,10 @@ Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash) xhv->xhv_fill--; if (flags & G_DISCARD) sv = Nullsv; - else - sv = sv_mortalcopy(HeVAL(entry)); + else { + sv = HeVAL(entry); + HeVAL(entry) = &PL_sv_undef; + } if (entry == xhv->xhv_eiter) HvLAZYDEL_on(hv); else |