Skip to content

Commit e05687f

Browse files
tonycozmauke
authored andcommitted
regcomp_internal.h: simplify vFAIL*() macros
These can be simpler, and since we allow use of __VA_ARGS__ we can consolidate Simple_vFAIL[1-4]() into Simple_vFAILn()
1 parent 388bf71 commit e05687f

File tree

1 file changed

+8
-42
lines changed

1 file changed

+8
-42
lines changed

regcomp_internal.h

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -922,55 +922,21 @@ static const scan_data_t zero_scan_data = {
922922
m, REPORT_LOCATION_ARGS(RExC_parse)); \
923923
} STMT_END
924924

925-
/*
926-
* Calls SAVEDESTRUCTOR_X if needed, then Simple_vFAIL()
927-
*/
928-
#define vFAIL(m) STMT_START { \
929-
Simple_vFAIL(m); \
930-
} STMT_END
931-
932-
/*
933-
* Like Simple_vFAIL(), but accepts two arguments.
934-
*/
935-
#define Simple_vFAIL2(m,a1) STMT_START { \
936-
S_re_croak(aTHX_ UTF, m REPORT_LOCATION, a1, \
937-
REPORT_LOCATION_ARGS(RExC_parse)); \
938-
} STMT_END
925+
#define vFAIL(m) Simple_vFAIL(m)
939926

940927
/*
941-
* Calls SAVEDESTRUCTOR_X if needed, then Simple_vFAIL2().
928+
* Like Simple_vFAIL(), but accepts extra arguments.
942929
*/
943-
#define vFAIL2(m,a1) STMT_START { \
944-
Simple_vFAIL2(m, a1); \
930+
#define Simple_vFAILn(m, ...) STMT_START { \
931+
S_re_croak(aTHX_ UTF, m REPORT_LOCATION, __VA_ARGS__, \
932+
REPORT_LOCATION_ARGS(RExC_parse)); \
945933
} STMT_END
946934

935+
#define vFAIL2(m,a1) Simple_vFAILn(m, a1)
947936

948-
/*
949-
* Like Simple_vFAIL(), but accepts three arguments.
950-
*/
951-
#define Simple_vFAIL3(m, a1, a2) STMT_START { \
952-
S_re_croak(aTHX_ UTF, m REPORT_LOCATION, a1, a2, \
953-
REPORT_LOCATION_ARGS(RExC_parse)); \
954-
} STMT_END
937+
#define vFAIL3(m,a1,a2) Simple_vFAILn(m, a1, a2)
955938

956-
/*
957-
* Calls SAVEDESTRUCTOR_X if needed, then Simple_vFAIL3().
958-
*/
959-
#define vFAIL3(m,a1,a2) STMT_START { \
960-
Simple_vFAIL3(m, a1, a2); \
961-
} STMT_END
962-
963-
/*
964-
* Like Simple_vFAIL(), but accepts four arguments.
965-
*/
966-
#define Simple_vFAIL4(m, a1, a2, a3) STMT_START { \
967-
S_re_croak(aTHX_ UTF, m REPORT_LOCATION, a1, a2, a3, \
968-
REPORT_LOCATION_ARGS(RExC_parse)); \
969-
} STMT_END
970-
971-
#define vFAIL4(m,a1,a2,a3) STMT_START { \
972-
Simple_vFAIL4(m, a1, a2, a3); \
973-
} STMT_END
939+
#define vFAIL4(m,a1,a2,a3) Simple_vFAILn(m, a1, a2, a3)
974940

975941
/* A specialized version of vFAIL2 that works with UTF8f */
976942
#define vFAIL2utf8f(m, a1) STMT_START { \

0 commit comments

Comments
 (0)