diff options
author | Gisle Aas <gisle@aas.no> | 1998-06-29 14:36:09 +0200 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-06-30 05:17:33 +0000 |
commit | f1192ceea6b2a126a4ff3254f91c2bc47c361c71 (patch) | |
tree | 2bca20552574a90634d783266fcb9ce8a3d90b2c /mg.c | |
parent | 25eaa2138d60ea820620e1b1324f90a6b4f4adcd (diff) | |
download | perl-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.c | 48 |
1 files changed, 0 insertions, 48 deletions
@@ -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; } |