summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-17 18:09:08 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-17 18:09:08 +0000
commit94f7643d7f26ed53393f1ab3452245da43de285e (patch)
tree15e7dd66ec0e667152680805ff1a71dcb227d9a1 /hv.c
parent60e71179391c62fd08759b910342438d90159dc2 (diff)
downloadperl-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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hv.c b/hv.c
index c591cbf2a8..8431cf7aa4 100644
--- a/hv.c
+++ b/hv.c
@@ -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