Skip to content

Commit

Permalink
WS Cleanup Stage #8 - join short continuations
Browse files Browse the repository at this point in the history
  • Loading branch information
demerphq committed Nov 5, 2022
1 parent 76d3dbc commit 9ffa0dc
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 96 deletions.
5 changes: 2 additions & 3 deletions av.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ need is to look up an array element, then prefer C<av_fetch>.

#define AvREALISH(av) (SvFLAGS(av) & (SVpav_REAL|SVpav_REIFY))

#define AvFILL(av) \
((SvRMAGICAL((const SV *) (av))) \
? mg_size(MUTABLE_SV(av)) : AvFILLp(av))
#define AvFILL(av) \
((SvRMAGICAL((const SV *) (av))) ? mg_size(MUTABLE_SV(av)) : AvFILLp(av))
#define av_top_index(av) AvFILL(av)
#define av_tindex(av) av_top_index(av)

Expand Down
34 changes: 13 additions & 21 deletions cop.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,7 @@ typedef struct rcpv RCPV;
# define CopFILE(c) ((c)->cop_file)
# define CopFILE_LEN(c) (CopFILE(c) ? RCPV_LEN(CopFILE(c)) : 0)
# define CopFILEGV(c) \
(CopFILE(c) \
? gv_fetchfile(CopFILE(c)) : NULL)
(CopFILE(c) ? gv_fetchfile(CopFILE(c)) : NULL)

# define CopFILE_set_x(c,pv) \
((c)->cop_file = rcpv_new((pv),0,RCPVf_USE_STRLEN))
Expand Down Expand Up @@ -600,11 +599,9 @@ typedef struct rcpv RCPV;


# define CopFILESV(c) \
(CopFILE(c) \
? GvSV(gv_fetchfile(CopFILE(c))) : NULL)
(CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : NULL)
# define CopFILEAV(c) \
(CopFILE(c) \
? GvAV(gv_fetchfile(CopFILE(c))) : NULL)
(CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : NULL)
# define CopFILEAVx(c) \
(assert_(CopFILE(c)) \
GvAV(gv_fetchfile(CopFILE(c))))
Expand Down Expand Up @@ -1137,22 +1134,17 @@ struct context {
#define CXp_ONCE 0x10 /* What was sbu_once in struct subst */

#define CxTYPE(c) ((c)->cx_type & CXTYPEMASK)
#define CxTYPE_is_LOOP(c) \
( CxTYPE(cx) >= CXt_LOOP_ARY \
&& CxTYPE(cx) <= CXt_LOOP_PLAIN)
#define CxTYPE_is_LOOP(c) \
( CxTYPE(cx) >= CXt_LOOP_ARY && CxTYPE(cx) <= CXt_LOOP_PLAIN)
#define CxMULTICALL(c) ((c)->cx_type & CXp_MULTICALL)
#define CxREALEVAL(c) \
(((c)->cx_type & (CXTYPEMASK|CXp_REAL)) \
== (CXt_EVAL|CXp_REAL))
#define CxEVALBLOCK(c) \
(((c)->cx_type & (CXTYPEMASK|CXp_EVALBLOCK)) \
== (CXt_EVAL|CXp_EVALBLOCK))
#define CxTRY(c) \
(((c)->cx_type & (CXTYPEMASK|CXp_TRY)) \
== (CXt_EVAL|CXp_TRY))
#define CxFOREACH(c) \
( CxTYPE(cx) >= CXt_LOOP_ARY \
&& CxTYPE(cx) <= CXt_LOOP_LIST)
#define CxREALEVAL(c) \
(((c)->cx_type & (CXTYPEMASK|CXp_REAL)) == (CXt_EVAL|CXp_REAL))
#define CxEVALBLOCK(c) \
(((c)->cx_type & (CXTYPEMASK|CXp_EVALBLOCK)) == (CXt_EVAL|CXp_EVALBLOCK))
#define CxTRY(c) \
(((c)->cx_type & (CXTYPEMASK|CXp_TRY)) == (CXt_EVAL|CXp_TRY))
#define CxFOREACH(c) \
( CxTYPE(cx) >= CXt_LOOP_ARY && CxTYPE(cx) <= CXt_LOOP_LIST)

/* private flags for CXt_DEFER */
#define CXp_FINALLY 0x20 /* `finally` block; semantically identical
Expand Down
8 changes: 3 additions & 5 deletions handy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,7 @@ or casts
/* The '| 0' part in ASSERT_NOT_PTR ensures a compiler error
* if c is not integer (like e.g., a pointer) */
# define FITS_IN_8_BITS(c) \
( (sizeof(c) == 1) \
|| (((WIDEST_UTYPE) ASSERT_NOT_PTR(c)) >> 8) == 0)
( (sizeof(c) == 1) || (((WIDEST_UTYPE) ASSERT_NOT_PTR(c)) >> 8) == 0)
#else
# define FITS_IN_8_BITS(c) (1)
#endif
Expand Down Expand Up @@ -2769,9 +2768,8 @@ PoisonWith(0xEF) for catching access to freed memory.
((_MEM_WRAP_NEEDS_RUNTIME_CHECK(n,t) ? (MEM_SIZE)(n) : \
MEM_SIZE_MAX/sizeof(t)) > MEM_SIZE_MAX/sizeof(t))

# define MEM_WRAP_CHECK(n,t) \
(void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \
&& (croak_memory_wrap(),0))
# define MEM_WRAP_CHECK(n,t) \
(void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) && (croak_memory_wrap(),0))

# define MEM_WRAP_CHECK_1(n,t,a) \
(void)(UNLIKELY(_MEM_WRAP_WILL_WRAP(n,t)) \
Expand Down
5 changes: 2 additions & 3 deletions hv_macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
#define U8TO32_LE(ptr) (*((const U32*)(ptr)))
#define U8TO64_LE(ptr) (*((const U64*)(ptr)))
#else
#define U8TO16_LE(ptr) \
(_shifted_octet(U16,(ptr),0, 0)| \
_shifted_octet(U16,(ptr),1, 8))
#define U8TO16_LE(ptr) \
(_shifted_octet(U16,(ptr),0, 0)| _shifted_octet(U16,(ptr),1, 8))

#define U8TO32_LE(ptr) \
(_shifted_octet(U32,(ptr),0, 0)| \
Expand Down
10 changes: 4 additions & 6 deletions op.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,10 @@ typedef enum {
# define IS_PADCONST(v) \
(v && (SvREADONLY(v) || (SvIsCOW(v) && !SvLEN(v))))
# endif
# define cSVOPx_sv(v) \
(cSVOPx(v)->op_sv \
? cSVOPx(v)->op_sv : PAD_SVl((v)->op_targ))
# define cSVOPx_svp(v) \
(cSVOPx(v)->op_sv \
? &cSVOPx(v)->op_sv : &PAD_SVl((v)->op_targ))
# define cSVOPx_sv(v) \
(cSVOPx(v)->op_sv ? cSVOPx(v)->op_sv : PAD_SVl((v)->op_targ))
# define cSVOPx_svp(v) \
(cSVOPx(v)->op_sv ? &cSVOPx(v)->op_sv : &PAD_SVl((v)->op_targ))
# define cMETHOPx_meth(v) \
(cMETHOPx(v)->op_u.op_meth_sv \
? cMETHOPx(v)->op_u.op_meth_sv : PAD_SVl((v)->op_targ))
Expand Down
3 changes: 1 addition & 2 deletions op_reg_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ get_regex_charset(const U32 flags)
| RXf_PMf_STRICT )

#define RXf_PMf_FLAGCOPYMASK \
( RXf_PMf_COMPILETIME \
| RXf_PMf_SPLIT )
( RXf_PMf_COMPILETIME | RXf_PMf_SPLIT )

/* Temporary to get Jenkins happy again See thread starting at
* http://nntp.perl.org/group/perl.perl5.porters/220710
Expand Down
11 changes: 4 additions & 7 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,8 @@ Now a synonym for C<L</dTHXa>>.
# define CALLREGDUPE(prog,param) \
Perl_re_dup(aTHX_ (prog),(param))

# define CALLREGDUPE_PVT(prog,param) \
(prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) \
: (REGEXP *)NULL)
# define CALLREGDUPE_PVT(prog,param) \
(prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) : (REGEXP *)NULL)
#endif

/* some compilers impersonate gcc */
Expand Down Expand Up @@ -6859,8 +6858,7 @@ typedef struct am_table_short AMTS;
/* Returns TRUE if the plain locale pragma
* without a parameter is in effect. */
# define IN_LOCALE_RUNTIME \
(PL_curcop \
&& CopHINTS_get(PL_curcop) & HINT_LOCALE)
(PL_curcop && CopHINTS_get(PL_curcop) & HINT_LOCALE)

/* Returns TRUE if either form of the locale pragma is in effect */
# define IN_SOME_LOCALE_FORM_RUNTIME \
Expand Down Expand Up @@ -8131,8 +8129,7 @@ extern void moncontrol(int);
PERL_UNICODE_STDERR_FLAG)

#define PERL_UNICODE_INOUT_FLAG \
(PERL_UNICODE_IN_FLAG | \
PERL_UNICODE_OUT_FLAG)
(PERL_UNICODE_IN_FLAG | PERL_UNICODE_OUT_FLAG)

#define PERL_UNICODE_DEFAULT_FLAGS \
(PERL_UNICODE_STD_FLAG | \
Expand Down
10 changes: 4 additions & 6 deletions regcomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,10 @@ struct regnode_ssc {
(((struct regnode_lstring *)p)->string))
#define OPERANDl(p) STRINGl(p)

#define STR_LEN(p) \
((OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \
? STR_LENl(p) : STR_LENs(p))
#define STRING(p) \
((OP(p) == LEXACT || OP(p) == LEXACT_REQ8) \
? STRINGl(p) : STRINGs(p))
#define STR_LEN(p) \
((OP(p) == LEXACT || OP(p) == LEXACT_REQ8) ? STR_LENl(p) : STR_LENs(p))
#define STRING(p) \
((OP(p) == LEXACT || OP(p) == LEXACT_REQ8) ? STRINGl(p) : STRINGs(p))
#define OPERAND(p) STRING(p)

/* The number of (smallest) regnode equivalents that a string of length l bytes
Expand Down
9 changes: 3 additions & 6 deletions regexp.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,17 +533,14 @@ SvRX instead and check for NULL.

/* For source compatibility. We used to store these explicitly. */
# define RX_PRECOMP(rx_sv) \
(RX_WRAPPED(rx_sv) \
+ ReANY(rx_sv)->pre_prefix)
(RX_WRAPPED(rx_sv) + ReANY(rx_sv)->pre_prefix)
# define RX_PRECOMP_const(rx_sv) \
(RX_WRAPPED_const(rx_sv) \
+ ReANY(rx_sv)->pre_prefix)
(RX_WRAPPED_const(rx_sv) + ReANY(rx_sv)->pre_prefix)
/* FIXME? Are we hardcoding too much here and constraining plugin extension
writers? Specifically, the value 1 assumes that the wrapped version always
has exactly one character at the end, a ')'. Will that always be true? */
# define RX_PRELEN(rx_sv) \
(RX_WRAPLEN(rx_sv) \
- ReANY(rx_sv)->pre_prefix - 1)
(RX_WRAPLEN(rx_sv) - ReANY(rx_sv)->pre_prefix - 1)

# define RX_WRAPPED(rx_sv) SvPVX(rx_sv)
# define RX_WRAPPED_const(rx_sv) SvPVX_const(rx_sv)
Expand Down
56 changes: 21 additions & 35 deletions sv.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,11 @@ the upgrade if necessary. See C<L</svtype>>.



#define SVf_THINKFIRST \
(SVf_READONLY|SVf_PROTECT|SVf_ROK|SVf_FAKE \
|SVs_RMG|SVf_IsCOW)
#define SVf_THINKFIRST \
(SVf_READONLY|SVf_PROTECT|SVf_ROK|SVf_FAKE |SVs_RMG|SVf_IsCOW)

#define SVf_OK \
(SVf_IOK|SVf_NOK|SVf_POK|SVf_ROK| \
SVp_IOK|SVp_NOK|SVp_POK|SVpgv_GP)
#define SVf_OK \
(SVf_IOK|SVf_NOK|SVf_POK|SVf_ROK| SVp_IOK|SVp_NOK|SVp_POK|SVpgv_GP)

#define PRIVSHIFT 4 /* (SVp_?OK >> PRIVSHIFT) == SVf_?OK */

Expand Down Expand Up @@ -922,9 +920,8 @@ Set the size of the string buffer for the SV. See C<L</SvLEN>>.

#define SvNIOK(sv) (SvFLAGS(sv) & (SVf_IOK|SVf_NOK))
#define SvNIOKp(sv) (SvFLAGS(sv) & (SVp_IOK|SVp_NOK))
#define SvNIOK_off(sv) \
(SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK| \
SVp_IOK|SVp_NOK|SVf_IVisUV))
#define SvNIOK_off(sv) \
(SvFLAGS(sv) &= ~(SVf_IOK|SVf_NOK| SVp_IOK|SVp_NOK|SVf_IVisUV))

#define assert_not_ROK(sv) assert_(!SvROK(sv) || !SvRV(sv))
#define assert_not_glob(sv) assert_(!isGV_with_GP(sv))
Expand Down Expand Up @@ -959,19 +956,16 @@ Set the size of the string buffer for the SV. See C<L</SvLEN>>.
SvFLAGS(sv) |= (SVf_IOK|SVp_IOK))
#define SvIOK_off(sv) (SvFLAGS(sv) &= ~(SVf_IOK|SVp_IOK|SVf_IVisUV))
#define SvIOK_only(sv) \
(SvOK_off(sv), \
SvFLAGS(sv) |= (SVf_IOK|SVp_IOK))
(SvOK_off(sv), SvFLAGS(sv) |= (SVf_IOK|SVp_IOK))
#define SvIOK_only_UV(sv) \
(assert_not_glob(sv) SvOK_off_exc_UV(sv), \
SvFLAGS(sv) |= (SVf_IOK|SVp_IOK))

#define SvIOK_UV(sv) \
((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \
== (SVf_IOK|SVf_IVisUV))
#define SvIOK_UV(sv) \
((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) == (SVf_IOK|SVf_IVisUV))
#define SvUOK(sv) SvIOK_UV(sv)
#define SvIOK_notUV(sv) \
((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \
== SVf_IOK)
#define SvIOK_notUV(sv) \
((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) == SVf_IOK)

#define SvIandPOK(sv) \
((SvFLAGS(sv) & (SVf_IOK|SVf_POK)) == (SVf_IOK|SVf_POK))
Expand All @@ -987,11 +981,9 @@ Set the size of the string buffer for the SV. See C<L</SvLEN>>.
(SvIsCOW_static(sv) && \
(SvPVX_const(sv) == PL_Yes || SvPVX_const(sv) == PL_No))
#define BOOL_INTERNALS_sv_isbool_true(sv) \
(SvIsCOW_static(sv) && \
(SvPVX_const(sv) == PL_Yes))
(SvIsCOW_static(sv) && (SvPVX_const(sv) == PL_Yes))
#define BOOL_INTERNALS_sv_isbool_false(sv) \
(SvIsCOW_static(sv) && \
(SvPVX_const(sv) == PL_No))
(SvIsCOW_static(sv) && (SvPVX_const(sv) == PL_No))

#define SvIsUV(sv) (SvFLAGS(sv) & SVf_IVisUV)
#define SvIsUV_on(sv) (SvFLAGS(sv) |= SVf_IVisUV)
Expand All @@ -1003,8 +995,7 @@ Set the size of the string buffer for the SV. See C<L</SvLEN>>.
SvFLAGS(sv) |= (SVf_NOK|SVp_NOK))
#define SvNOK_off(sv) (SvFLAGS(sv) &= ~(SVf_NOK|SVp_NOK))
#define SvNOK_only(sv) \
(SvOK_off(sv), \
SvFLAGS(sv) |= (SVf_NOK|SVp_NOK))
(SvOK_off(sv), SvFLAGS(sv) |= (SVf_NOK|SVp_NOK))

/*
=for apidoc Am|U32|SvUTF8|SV* sv
Expand Down Expand Up @@ -1054,8 +1045,7 @@ the UTF-8 status as it was.
SvFLAGS(sv) |= (SVf_POK|SVp_POK))

#define SvVOK(sv) \
(SvMAGICAL(sv) \
&& mg_find(sv,PERL_MAGIC_vstring))
(SvMAGICAL(sv) && mg_find(sv,PERL_MAGIC_vstring))
/*
=for apidoc Am|MAGIC*|SvVSTRING_mg|SV * sv
Expand All @@ -1064,8 +1054,7 @@ Returns the vstring magic, or NULL if none
=cut
*/
#define SvVSTRING_mg(sv) \
(SvMAGICAL(sv) \
? mg_find(sv,PERL_MAGIC_vstring) : NULL)
(SvMAGICAL(sv) ? mg_find(sv,PERL_MAGIC_vstring) : NULL)

#define SvOOK(sv) (SvFLAGS(sv) & SVf_OOK)
#define SvOOK_on(sv) (SvFLAGS(sv) |= SVf_OOK)
Expand Down Expand Up @@ -1114,9 +1103,8 @@ Returns a boolean as to whether C<sv> has overloading
=cut
*/

#define SvAMAGIC(sv) \
(SvROK(sv) && SvOBJECT(SvRV(sv)) && \
HvAMAGIC(SvSTASH(SvRV(sv))))
#define SvAMAGIC(sv) \
(SvROK(sv) && SvOBJECT(SvRV(sv)) && HvAMAGIC(SvSTASH(SvRV(sv))))

/* To be used on the stashes themselves: */
#define HvAMAGIC(hv) (SvFLAGS(hv) & SVf_AMAGIC)
Expand Down Expand Up @@ -1190,9 +1178,8 @@ is true then the scalar's value cannot change unless written to.
? 1 \
: (HvAMAGIC_off(stash), 0))

#define SvWEAKREF(sv) \
((SvFLAGS(sv) & (SVf_ROK|SVprv_WEAKREF)) \
== (SVf_ROK|SVprv_WEAKREF))
#define SvWEAKREF(sv) \
((SvFLAGS(sv) & (SVf_ROK|SVprv_WEAKREF)) == (SVf_ROK|SVprv_WEAKREF))
#define SvWEAKREF_on(sv) (SvFLAGS(sv) |= (SVf_ROK|SVprv_WEAKREF))
#define SvWEAKREF_off(sv) (SvFLAGS(sv) &= ~(SVf_ROK|SVprv_WEAKREF))

Expand Down Expand Up @@ -2404,8 +2391,7 @@ already have a PV buffer allocated, but no SvTHINKFIRST.

/* the SvREADONLY() test is to quickly reject most SVs */
#define SvIMMORTAL(sv) \
( SvREADONLY(sv) \
&& (SvIMMORTAL_INTERP(sv) || (sv) == &PL_sv_placeholder))
( SvREADONLY(sv) && (SvIMMORTAL_INTERP(sv) || (sv) == &PL_sv_placeholder))

#ifdef DEBUGGING
/* exercise the immortal resurrection code in sv_free2() */
Expand Down
3 changes: 1 addition & 2 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
|| ((f)[0] && (f)[1] == ':')) /* drive name */
#elif defined(DOSISH)
# define PERL_FILE_IS_ABSOLUTE(f) \
(*(f) == '/' \
|| ((f)[0] && (f)[1] == ':')) /* drive name */
(*(f) == '/' || ((f)[0] && (f)[1] == ':')) /* drive name */
#else /* NOT DOSISH */
# define PERL_FILE_IS_ABSOLUTE(f) (*(f) == '/')
#endif
Expand Down

0 comments on commit 9ffa0dc

Please sign in to comment.