Skip to content

Commit 0eadbda

Browse files
committed
Rename S_stashpvn to S_gv_stashpvn_internal and add to embed.fnc
S_stashpvn was not added to embed.fnc properly, and is named contrary to general expectations of the Perl internals. This fixes that, there should be no other functional differences.
1 parent ea46425 commit 0eadbda

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

embed.fnc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,9 @@ px |GV * |gv_override |NN const char * const name \
548548
XMpd |void |gv_try_downgrade|NN GV* gv
549549
Apd |HV* |gv_stashpv |NN const char* name|I32 flags
550550
Apd |HV* |gv_stashpvn |NN const char* name|U32 namelen|I32 flags
551+
#if defined(PERL_IN_GV_C)
552+
i |HV* |gv_stashpvn_internal|NN const char* name|U32 namelen|I32 flags
553+
#endif
551554
Apd |HV* |gv_stashsv |NN SV* sv|I32 flags
552555
Apd |void |hv_clear |NULLOK HV *hv
553556
: used in SAVEHINTS() and op.c

embed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@
14391439
#define gv_is_in_main(a,b,c) S_gv_is_in_main(aTHX_ a,b,c)
14401440
#define gv_magicalize(a,b,c,d,e,f) S_gv_magicalize(aTHX_ a,b,c,d,e,f)
14411441
#define gv_magicalize_isa(a) S_gv_magicalize_isa(aTHX_ a)
1442+
#define gv_stashpvn_internal(a,b,c) S_gv_stashpvn_internal(aTHX_ a,b,c)
14421443
#define maybe_multimagic_gv(a,b,c) S_maybe_multimagic_gv(aTHX_ a,b,c)
14431444
#define parse_gv_stash_name(a,b,c,d,e,f,g,h) S_parse_gv_stash_name(aTHX_ a,b,c,d,e,f,g,h)
14441445
#define require_tie_mod(a,b,c,d,e) S_require_tie_mod(aTHX_ a,b,c,d,e)

gv.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,16 +1316,24 @@ The most important of which are probably GV_ADD and SVf_UTF8.
13161316
=cut
13171317
*/
13181318

1319+
/*
1320+
gv_stashpvn_internal
1321+
1322+
Perform the internal bits of gv_stashsvpvn_cached. You could think of this
1323+
as being one half of the logic. Not to be called except from gv_stashsvpvn_cached().
1324+
1325+
*/
1326+
13191327
PERL_STATIC_INLINE HV*
1320-
S_stashpvn(pTHX_ const char *name, U32 namelen, I32 flags)
1328+
S_gv_stashpvn_internal(pTHX_ const char *name, U32 namelen, I32 flags)
13211329
{
13221330
char smallbuf[128];
13231331
char *tmpbuf;
13241332
HV *stash;
13251333
GV *tmpgv;
13261334
U32 tmplen = namelen + 2;
13271335

1328-
PERL_ARGS_ASSERT_GV_STASHPVN;
1336+
PERL_ARGS_ASSERT_GV_STASHPVN_INTERNAL;
13291337

13301338
if (tmplen <= sizeof smallbuf)
13311339
tmpbuf = smallbuf;
@@ -1365,10 +1373,11 @@ Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 flags)
13651373
if (he) return INT2PTR(HV*,SvIVX(HeVAL(he)));
13661374
else if (flags & GV_CACHE_ONLY) return NULL;
13671375

1368-
stash = S_stashpvn(aTHX_ name, namelen, flags);
1376+
stash = gv_stashpvn_internal(name, namelen, flags);
1377+
13691378
if (stash && namelen) {
13701379
SV* const ref = newSViv(PTR2IV(stash));
1371-
hv_store(PL_stashcache, name,
1380+
(void)hv_store(PL_stashcache, name,
13721381
(flags & SVf_UTF8) ? -(I32)namelen : (I32)namelen, ref, 0);
13731382
}
13741383
return stash;

proto.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5907,6 +5907,11 @@ STATIC void S_gv_magicalize_isa(pTHX_ GV *gv)
59075907
#define PERL_ARGS_ASSERT_GV_MAGICALIZE_ISA \
59085908
assert(gv)
59095909

5910+
PERL_STATIC_INLINE HV* S_gv_stashpvn_internal(pTHX_ const char* name, U32 namelen, I32 flags)
5911+
__attribute__nonnull__(pTHX_1);
5912+
#define PERL_ARGS_ASSERT_GV_STASHPVN_INTERNAL \
5913+
assert(name)
5914+
59105915
STATIC void S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
59115916
__attribute__nonnull__(pTHX_1)
59125917
__attribute__nonnull__(pTHX_2);

0 commit comments

Comments
 (0)