X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/c9182d9cfe39bfb5131aaf232745d5856cbf79eb..1bd041dce8bb8fa2727af6630fb35f00c0c05a65:/inline.h diff --git a/inline.h b/inline.h index dfbb985..a63feed 100644 --- a/inline.h +++ b/inline.h @@ -53,15 +53,19 @@ Perl_av_top_index(pTHX_ AV *av) PERL_STATIC_INLINE GV * Perl_CvGV(pTHX_ CV *sv) { + PERL_ARGS_ASSERT_CVGV; + return CvNAMED(sv) ? Perl_cvgv_from_hek(aTHX_ sv) : ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv_u.xcv_gv; } PERL_STATIC_INLINE I32 * -Perl_CvDEPTHp(const CV * const sv) +Perl_CvDEPTH(const CV * const sv) { + PERL_ARGS_ASSERT_CVDEPTH; assert(SvTYPE(sv) == SVt_PVCV || SvTYPE(sv) == SVt_PVFM); + return &((XPVCV*)SvANY(sv))->xcv_depth; } @@ -119,8 +123,10 @@ S_MgBYTEPOS(pTHX_ MAGIC *mg, SV *sv, const char *s, STRLEN len) #if defined(PERL_IN_PAD_C) || defined(PERL_IN_OP_C) PERL_STATIC_INLINE bool -PadnameIN_SCOPE(const PADNAME * const pn, const U32 seq) +S_PadnameIN_SCOPE(const PADNAME * const pn, const U32 seq) { + PERL_ARGS_ASSERT_PADNAMEIN_SCOPE; + /* is seq within the range _LOW to _HIGH ? * This is complicated by the fact that PL_cop_seqmax * may have wrapped around at some point */ @@ -196,6 +202,8 @@ Perl_SvREFCNT_inc(SV *sv) PERL_STATIC_INLINE SV * Perl_SvREFCNT_inc_NN(SV *sv) { + PERL_ARGS_ASSERT_SVREFCNT_INC_NN; + SvREFCNT(sv)++; return sv; } @@ -221,6 +229,9 @@ PERL_STATIC_INLINE void Perl_SvREFCNT_dec_NN(pTHX_ SV *sv) { U32 rc = SvREFCNT(sv); + + PERL_ARGS_ASSERT_SVREFCNT_DEC_NN; + if (LIKELY(rc > 1)) SvREFCNT(sv) = rc - 1; else @@ -228,14 +239,18 @@ Perl_SvREFCNT_dec_NN(pTHX_ SV *sv) } PERL_STATIC_INLINE void -SvAMAGIC_on(SV *sv) +Perl_SvAMAGIC_on(SV *sv) { + PERL_ARGS_ASSERT_SVAMAGIC_ON; assert(SvROK(sv)); + if (SvOBJECT(SvRV(sv))) HvAMAGIC_on(SvSTASH(SvRV(sv))); } PERL_STATIC_INLINE void -SvAMAGIC_off(SV *sv) +Perl_SvAMAGIC_off(SV *sv) { + PERL_ARGS_ASSERT_SVAMAGIC_OFF; + if (SvROK(sv) && SvOBJECT(SvRV(sv))) HvAMAGIC_off(SvSTASH(SvRV(sv))); } @@ -466,7 +481,7 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) # if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 \ || BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 - *ep = x + _variant_byte_number(* (PERL_UINTMAX_T *) x); + *ep = x + variant_byte_number(* (PERL_UINTMAX_T *) x); assert(*ep >= s && *ep < send); return FALSE; @@ -504,7 +519,7 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep) #ifndef EBCDIC PERL_STATIC_INLINE unsigned int -Perl__variant_byte_number(PERL_UINTMAX_T word) +Perl_variant_byte_number(PERL_UINTMAX_T word) { /* This returns the position in a word (0..7) of the first variant byte in @@ -1078,7 +1093,7 @@ Perl_isUTF8_CHAR(const U8 * const s0, const U8 * const e) #if defined(UV_IS_QUAD) || defined(EBCDIC) if (NATIVE_UTF8_TO_I8(*s0) == 0xFF && e - s0 >= UTF8_MAXBYTES) { - return _is_utf8_char_helper(s0, e, 0); + return is_utf8_char_helper(s0, e, 0); } #endif @@ -1702,7 +1717,7 @@ Perl_is_utf8_valid_partial_char_flags(const U8 * const s, const U8 * const e, co return FALSE; } - return cBOOL(_is_utf8_char_helper(s, e, flags)); + return cBOOL(is_utf8_char_helper(s, e, flags)); } /* @@ -1843,9 +1858,9 @@ Perl_utf8n_to_uvchr_msgs(const U8 *s, } PERL_STATIC_INLINE UV -Perl__utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) +Perl_utf8_to_uvchr_buf_helper(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) { - PERL_ARGS_ASSERT__UTF8_TO_UVCHR_BUF; + PERL_ARGS_ASSERT_UTF8_TO_UVCHR_BUF_HELPER; assert(s < send); @@ -1885,7 +1900,8 @@ Used by the C macro. */ PERL_STATIC_INLINE bool -Perl_is_safe_syscall(pTHX_ const char *pv, STRLEN len, const char *what, const char *op_name) { +Perl_is_safe_syscall(pTHX_ const char *pv, STRLEN len, const char *what, const char *op_name) +{ /* While the Windows CE API provides only UCS-16 (or UTF-16) APIs * perl itself uses xce*() functions which accept 8-bit strings. */ @@ -1926,7 +1942,8 @@ then calling: #ifdef PERL_CORE PERL_STATIC_INLINE bool -S_should_warn_nl(const char *pv) { +S_should_warn_nl(const char *pv) +{ STRLEN len; PERL_ARGS_ASSERT_SHOULD_WARN_NL; @@ -1974,11 +1991,15 @@ S_lossless_NV_to_IV(const NV nv, IV *ivp) /* ------------------ pp.c, regcomp.c, toke.c, universal.c ------------ */ +#if defined(PERL_IN_PP_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) || defined(PERL_IN_UNIVERSAL_C) + #define MAX_CHARSET_NAME_LENGTH 2 PERL_STATIC_INLINE const char * -get_regex_charset_name(const U32 flags, STRLEN* const lenp) +S_get_regex_charset_name(const U32 flags, STRLEN* const lenp) { + PERL_ARGS_ASSERT_GET_REGEX_CHARSET_NAME; + /* Returns a string that corresponds to the name of the regex character set * given by 'flags', and *lenp is set the length of that string, which * cannot exceed MAX_CHARSET_NAME_LENGTH characters */ @@ -1999,6 +2020,8 @@ get_regex_charset_name(const U32 flags, STRLEN* const lenp) return "?"; /* Unknown */ } +#endif + /* Return false if any get magic is on the SV other than taint magic. @@ -2006,7 +2029,8 @@ Return false if any get magic is on the SV other than taint magic. */ PERL_STATIC_INLINE bool -Perl_sv_only_taint_gmagic(SV *sv) { +Perl_sv_only_taint_gmagic(SV *sv) +{ MAGIC *mg = SvMAGIC(sv); PERL_ARGS_ASSERT_SV_ONLY_TAINT_GMAGIC;