diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-09-01 22:00:43 +0000 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-09-01 22:00:43 +0000 |
commit | f967eb5f7ea656df97e47541e42689728310e560 (patch) | |
tree | ecc5c7bba743513bb24a37d307e0e84e8839d16e /gv.c | |
parent | a26b07455ad7b4e24ed0c8c0c352c4cfa06b15ec (diff) | |
download | perl-f967eb5f7ea656df97e47541e42689728310e560.tar.gz |
perl 5.003_04: dump.c gv.c op.c pp_ctl.c pp_sys.c proto.h run.c
This patch changes neither behavior nor performance. However, it does
reduce code size and improve maintainability by combining some common
code in gv_fullname() and gv_efullname().
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -687,38 +687,32 @@ I32 sv_type; } void -gv_fullname(sv,gv) +gv_fullname(sv, gv, prefix) SV *sv; GV *gv; +char *prefix; { HV *hv = GvSTASH(gv); - - if (!hv) + if (!hv) { + SvOK_off(sv); return; - sv_setpv(sv, sv == (SV*)gv ? "*" : ""); + } + sv_setpv(sv, prefix ? prefix : ""); sv_catpv(sv,HvNAME(hv)); sv_catpvn(sv,"::", 2); sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv)); } void -gv_efullname(sv,gv) +gv_efullname(sv, gv, prefix) SV *sv; GV *gv; +char *prefix; { - GV* egv = GvEGV(gv); - HV *hv; - + GV *egv = GvEGV(gv); if (!egv) egv = gv; - hv = GvSTASH(egv); - if (!hv) - return; - - sv_setpv(sv, sv == (SV*)gv ? "*" : ""); - sv_catpv(sv,HvNAME(hv)); - sv_catpvn(sv,"::", 2); - sv_catpvn(sv,GvNAME(egv),GvNAMELEN(egv)); + gv_fullname(sv, egv, prefix); } IO * |