summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2003-03-11 15:29:31 -0600
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-03-13 20:46:53 +0000
commitf08cf8c782f69f7616abefbb3b247a3ec9d6264e (patch)
treeebde1ceb0dc810e3e8e2ba8ac9fd94be7916f30e /hv.c
parent073b6de5ebd9c2bf9cbf67cdf30d2de79cdd279f (diff)
downloadperl-f08cf8c782f69f7616abefbb3b247a3ec9d6264e.tar.gz
checking for magic in hv.c and ext/POSIX/POSIX.xs
From: "Craig A. Berry" <craigberry@mac.com> Message-ID: <3E6EA99B.9060902@mac.com> Patch by Scott Lepage (scott.lepage@hp.com) p4raw-id: //depot/perl@18962
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 b038d34e2b..c798f1b01d 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 */