Skip to content

Commit f651c04

Browse files
committed
perlapi: Fold in gv_autoload4 to gv_autoload_pv group
And correct some of the misleading documentation previously there
1 parent 1b7e058 commit f651c04

File tree

4 files changed

+28
-19
lines changed

4 files changed

+28
-19
lines changed

embed.fnc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,10 +1291,6 @@ Adp |GV * |gv_add_by_type |NULLOK GV *gv \
12911291
|svtype type
12921292
Adp |int |Gv_AMupdate |NN HV *stash \
12931293
|bool destructing
1294-
ARdm |GV * |gv_autoload4 |NULLOK HV *stash \
1295-
|NN const char *name \
1296-
|STRLEN len \
1297-
|I32 method
12981294
ARdp |GV * |gv_autoload_pv |NULLOK HV *stash \
12991295
|NN const char *namepv \
13001296
|U32 flags

gv.c

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,34 +1296,51 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV *stash, const char *name, const STRLEN le
12961296
return gv;
12971297
}
12981298

1299-
13001299
/*
13011300
=for apidoc gv_autoload_pv
13021301
=for apidoc_item gv_autoload_pvn
13031302
=for apidoc_item gv_autoload_sv
1303+
=for apidoc_item gv_autoload4
13041304
13051305
These each search for an C<AUTOLOAD> method, returning NULL if not found, or
13061306
else returning a pointer to its GV, while setting the package
1307-
L<C<$AUTOLOAD>|perlobj/AUTOLOAD> variable to C<name> (fully qualified). Also,
1308-
if found and the GV's CV is an XSUB, the CV's PV will be set to C<name>, and
1307+
L<C<$AUTOLOAD>|perlobj/AUTOLOAD> variable to the name (fully qualified). Also,
1308+
if found and the GV's CV is an XSUB, the CV's PV will be set to the name, and
13091309
its stash will be set to the stash of the GV.
13101310
13111311
Searching is done in L<C<MRO> order|perlmroapi>, as specified in
13121312
L</C<gv_fetchmeth>>, beginning with C<stash> if it isn't NULL.
13131313
1314-
The forms differ only in how C<name> is specified.
1314+
C<gv_autoload4>) has a C<method> parameter; the others a C<flags> one (both
1315+
types explained below). Otherwise, the forms differ only in how the name is
1316+
specified.
13151317
13161318
In C<gv_autoload_pv>, C<namepv> is a C language NUL-terminated string.
13171319
1318-
In C<gv_autoload_pvn>, C<name> points to the first byte of the name, and an
1319-
additional parameter, C<len>, specifies its length in bytes. Hence, C<*name>
1320-
may contain embedded-NUL characters.
1320+
In C<gv_autoload_pvn> and C<gv_autoload4>), C<name> points to the first byte of
1321+
the name, and an additional parameter, C<len>, specifies its length in bytes.
1322+
Hence, C<*name> may contain embedded-NUL characters.
13211323
13221324
In C<gv_autoload_sv>, C<*namesv> is an SV, and the name is the PV extracted
13231325
from that using L</C<SvPV>>. If the SV is marked as being in UTF-8, the
13241326
extracted PV will also be.
13251327
1328+
The other way to indicate that the name is encoded as UTF-8 is to set the
1329+
C<SVf_UTF8> bit in C<flags> for the forms that have that parameter.
1330+
The name is never considered to be UTF-8 in C<gv_autoload4>.
1331+
1332+
The C<method> parameter in C<gv_autoload4> is used only to indicate that the
1333+
name is for a method (non-zero), or not (zero). The other forms use the
1334+
C<GV_AUTOLOAD_ISMETHOD> bit in C<flags> to indicate this.
1335+
1336+
The only other significant value in C<flags> currently is C<GV_SUPER>
1337+
to indicate, if set, to skip searching for the name in C<stash>.
1338+
13261339
=cut
1340+
1341+
=for apidoc Amnh||GV_AUTOLOAD_ISMETHOD
1342+
=for apidoc Amnh||SVf_UTF8
1343+
=for apidoc Amnh||GV_SUPER
13271344
*/
13281345

13291346
GV*

gv.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ Return the CV from the GV.
262262
#define GV_NOUNIVERSAL 0x2000 /* Skip UNIVERSAL lookup */
263263

264264
/* Flags for gv_autoload_*/
265-
#define GV_AUTOLOAD_ISMETHOD 1 /* autoloading a method? */
265+
#define GV_AUTOLOAD_ISMETHOD 1 /* autoloading a method? gv_autoload4 will
266+
break if this is changed from being 1 */
266267

267268
/* SVf_UTF8 (more accurately the return value from SvUTF8) is also valid
268269
as a flag to various gv_* functions, so ensure it lies
@@ -289,10 +290,9 @@ Return the CV from the GV.
289290
#define gv_fetchmethod_flags(stash,name,flags) gv_fetchmethod_pv_flags(stash, name, flags)
290291

291292
/*
292-
=for apidoc gv_autoload4
293-
Equivalent to C<L</gv_autoload_pvn>>.
294-
293+
=for apidoc_defn ARdp|GV *|gv_autoload4|NULLOK HV *stash|NN const char *name|STRLEN len|I32 method
295294
=cut
295+
296296
*/
297297
#define gv_autoload4(stash, name, len, autoload) \
298298
gv_autoload_pvn(stash, name, len, cBOOL(autoload))

proto.h

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)