diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-05-02 12:41:43 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-05-02 12:41:43 +0000 |
commit | f4890806d306bfeee79f1864c882eb307b4f54fd (patch) | |
tree | cca03a58610968601b3ada5869d34e24939210d8 /gv.h | |
parent | 178eff928e12522422417310bee9331fccc184cf (diff) | |
download | perl-f4890806d306bfeee79f1864c882eb307b4f54fd.tar.gz |
GvFILE() cannot be a pointer to the memory owned by the COP, because
COPs created by use can be freed along this memory, but the GP
remains. Given that several GVs may refer to the same file, use a
shared string rather than an individual allocation per GP.
p4raw-id: //depot/perl@28060
Diffstat (limited to 'gv.h')
-rw-r--r-- | gv.h | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -19,7 +19,7 @@ struct gp { CV * gp_cv; /* subroutine value */ U32 gp_cvgen; /* generational validity of cached gv_cv */ line_t gp_line; /* line first declared at (for -w) */ - char * gp_file; /* file first declared in (for -w) */ + HEK * gp_file_hek; /* file first declared in (for -w) */ }; #define GvXPVGV(gv) ((XPVGV*)SvANY(gv)) @@ -111,7 +111,8 @@ Return the SV from the GV. #define GvCVu(gv) (GvGP(gv)->gp_cvgen ? NULL : GvGP(gv)->gp_cv) #define GvLINE(gv) (GvGP(gv)->gp_line) -#define GvFILE(gv) (GvGP(gv)->gp_file) +#define GvFILE_HEK(gv) (GvGP(gv)->gp_file_hek) +#define GvFILE(gv) HEK_KEY(GvFILE_HEK(gv)) #define GvFILEGV(gv) (gv_fetchfile(GvFILE(gv))) #define GvEGV(gv) (GvGP(gv)->gp_egv) @@ -208,3 +209,13 @@ Return the SV from the GV. #define gv_fullname3(sv,gv,prefix) gv_fullname4(sv,gv,prefix,TRUE) #define gv_efullname3(sv,gv,prefix) gv_efullname4(sv,gv,prefix,TRUE) #define gv_fetchmethod(stash, name) gv_fetchmethod_autoload(stash, name, TRUE) + +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + * + * ex: set ts=8 sts=4 sw=4 noet: + */ |