summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorLarry Wall <larry@netlabs.com>1994-03-18 00:00:00 +0000
committerLarry Wall <larry@netlabs.com>1994-03-18 00:00:00 +0000
commit8990e3071044a96302560bbdb5706f3e74cf1bef (patch)
tree6cf4a58108544204591f25bd2d4f1801d49334b4 /hv.c
parented6116ce9b9d13712ea252ee248b0400653db7f9 (diff)
downloadperl-8990e3071044a96302560bbdb5706f3e74cf1bef.tar.gz
perl 5.0 alpha 6
[editor's note: cleaned up from the September '94 InfoMagic CD, just like the last commit]
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/hv.c b/hv.c
index b0958e290a..2468e87839 100644
--- a/hv.c
+++ b/hv.c
@@ -48,9 +48,9 @@ I32 lval;
if (!hv)
return 0;
- if (SvMAGICAL(hv)) {
+ if (SvRMAGICAL(hv)) {
if (mg_find((SV*)hv,'P')) {
- sv = sv_2mortal(NEWSV(61,0));
+ sv = sv_newmortal();
mg_copy((SV*)hv, sv, key, klen);
if (!lval) {
mg_get(sv);
@@ -111,7 +111,6 @@ register U32 hash;
xhv = (XPVHV*)SvANY(hv);
if (SvMAGICAL(hv)) {
- MAGIC* mg = SvMAGIC(hv);
mg_copy((SV*)hv, val, key, klen);
if (!xhv->xhv_array)
return 0;
@@ -136,7 +135,7 @@ register U32 hash;
continue;
if (bcmp(entry->hent_key,key,klen)) /* is this it? */
continue;
- sv_free(entry->hent_val);
+ SvREFCNT_dec(entry->hent_val);
entry->hent_val = val;
return &entry->hent_val;
}
@@ -175,7 +174,7 @@ U32 klen;
if (!hv)
return Nullsv;
- if (SvMAGICAL(hv)) {
+ if (SvRMAGICAL(hv)) {
sv = *hv_fetch(hv, key, klen, TRUE);
mg_clear(sv);
}
@@ -276,7 +275,7 @@ register HE *hent;
{
if (!hent)
return;
- sv_free(hent->hent_val);
+ SvREFCNT_dec(hent->hent_val);
Safefree(hent->hent_key);
Safefree(hent);
}
@@ -380,8 +379,8 @@ HV *hv;
xhv = (XPVHV*)SvANY(hv);
entry = xhv->xhv_eiter;
- if (SvMAGICAL(hv) && (mg = mg_find((SV*)hv,'P'))) {
- SV *key = sv_2mortal(NEWSV(0,0));
+ if (SvRMAGICAL(hv) && (mg = mg_find((SV*)hv,'P'))) {
+ SV *key = sv_newmortal();
if (entry)
sv_setpvn(key, entry->hent_key, entry->hent_klen);
else {
@@ -398,7 +397,7 @@ HV *hv;
return entry;
}
if (entry->hent_val)
- sv_free(entry->hent_val);
+ SvREFCNT_dec(entry->hent_val);
Safefree(entry);
xhv->xhv_eiter = Null(HE*);
return Null(HE*);
@@ -437,9 +436,9 @@ hv_iterval(hv,entry)
HV *hv;
register HE *entry;
{
- if (SvMAGICAL(hv)) {
+ if (SvRMAGICAL(hv)) {
if (mg_find((SV*)hv,'P')) {
- SV* sv = sv_2mortal(NEWSV(61,0));
+ SV* sv = sv_newmortal();
mg_copy((SV*)hv, sv, entry->hent_key, entry->hent_klen);
mg_get(sv);
sv_unmagic(sv,'p');