summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>1998-06-29 14:36:09 +0200
committerGurusamy Sarathy <gsar@cpan.org>1998-06-30 05:17:33 +0000
commitf1192ceea6b2a126a4ff3254f91c2bc47c361c71 (patch)
tree2bca20552574a90634d783266fcb9ce8a3d90b2c /mg.c
parent25eaa2138d60ea820620e1b1324f90a6b4f4adcd (diff)
downloadperl-f1192ceea6b2a126a4ff3254f91c2bc47c361c71.tar.gz
Re: [PATCH] Simplified magic_setisa() and improved fields.pm
Message-Id: <m367hk4hra.fsf@furu.g.aas.no> p4raw-id: //depot/perl@1266
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/mg.c b/mg.c
index def57c47b2..4f0616f6c9 100644
--- a/mg.c
+++ b/mg.c
@@ -899,55 +899,7 @@ magic_setsig(SV *sv, MAGIC *mg)
int
magic_setisa(SV *sv, MAGIC *mg)
{
- HV *stash;
- SV **svp;
- I32 fill;
- HV *basefields = Nullhv;
- GV **gvp;
- GV *gv;
- HE *he;
- static char *FIELDS = "FIELDS";
-
sub_generation++;
-
- if (mg->mg_type == 'i')
- return 0; /* Ignore lower-case version of the magic */
-
- stash = GvSTASH(mg->mg_obj);
- svp = AvARRAY((AV*)sv);
-
- /* NOTE: No support for tied ISA */
- for (fill = AvFILLp((AV*)sv); fill >= 0; fill--, svp++) {
- HV *basestash = gv_stashsv(*svp, FALSE);
-
- if (!basestash) {
- if (dowarn)
- warn("No such package \"%_\" in @ISA assignment", *svp);
- continue;
- }
- gvp = (GV**)hv_fetch(basestash, FIELDS, 6, FALSE);
- if (gvp && *gvp && GvHV(*gvp)) {
- if (basefields)
- croak("Can't multiply inherit %%FIELDS");
- basefields = GvHV(*gvp);
- }
- }
-
- if (!basefields)
- return 0;
-
- gv = (GV*)*hv_fetch(stash, FIELDS, 6, TRUE);
- if (!isGV(gv))
- gv_init(gv, stash, FIELDS, 6, TRUE);
- if (!GvHV(gv))
- GvHV(gv) = newHV();
- if (HvKEYS(GvHV(gv)))
- croak("Inherited %%FIELDS can't override existing %%FIELDS");
-
- hv_iterinit(GvHV(gv));
- while ((he = hv_iternext(basefields)))
- hv_store(GvHV(gv), HeKEY(he), HeKLEN(he), HeVAL(he), HeHASH(he));
-
return 0;
}