From: Craig A. Berry Date: Tue, 11 Mar 2003 21:29:31 +0000 (-0600) Subject: checking for magic in hv.c and ext/POSIX/POSIX.xs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f08cf8c782f69f7616abefbb3b247a3ec9d6264e;p=p5sagit%2Fp5-mst-13.2.git checking for magic in hv.c and ext/POSIX/POSIX.xs From: "Craig A. Berry" Message-ID: <3E6EA99B.9060902@mac.com> Patch by Scott Lepage (scott.lepage@hp.com) p4raw-id: //depot/perl@18962 --- diff --git a/hv.c b/hv.c index b038d34..c798f1b 100644 --- a/hv.c +++ b/hv.c @@ -868,8 +868,8 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen, I32 flags) if (!hv) return Nullsv; if (klen < 0) { - klen = -klen; - is_utf8 = TRUE; + klen = -klen; + is_utf8 = TRUE; } if (SvRMAGICAL(hv)) { bool needs_copy; @@ -878,7 +878,9 @@ Perl_hv_delete(pTHX_ HV *hv, const char *key, I32 klen, I32 flags) if (needs_copy && (svp = hv_fetch(hv, key, klen, TRUE))) { sv = *svp; - mg_clear(sv); + if (SvMAGICAL(sv)) { + mg_clear(sv); + } if (!needs_store) { if (mg_find(sv, PERL_MAGIC_tiedelem)) { /* No longer an element */ @@ -1031,7 +1033,9 @@ Perl_hv_delete_ent(pTHX_ HV *hv, SV *keysv, I32 flags, U32 hash) if (needs_copy && (entry = hv_fetch_ent(hv, keysv, TRUE, hash))) { sv = HeVAL(entry); - mg_clear(sv); + if (SvMAGICAL(sv)) { + mg_clear(sv); + } if (!needs_store) { if (mg_find(sv, PERL_MAGIC_tiedelem)) { /* No longer an element */