From 1e1ce5022a0accb8a84176e63f2a8730c66eca68 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 21 Oct 2024 13:29:32 -0600 Subject: [PATCH] Remove mathoms.c stub Perl_instr() This is now entirely implemented by macros --- embed.fnc | 2 +- embed.h | 1 + mathoms.c | 11 ----------- proto.h | 12 +++++------- util.h | 2 +- 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/embed.fnc b/embed.fnc index 71efeda0df..6af9f8a4fb 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1626,7 +1626,7 @@ Cp |void |init_stacks Cp |void |init_tm |NN struct tm *ptm p |void |init_uniprops : Used in perly.y -AMPRTbdp|char * |instr |NN const char *big \ +APRTdmp |char * |instr |NN const char *big \ |NN const char *little Adp |U32 |intro_my ERXp |Size_t |_inverse_folds |const UV cp \ diff --git a/embed.h b/embed.h index fdbcaa1db0..d2e4576a26 100644 --- a/embed.h +++ b/embed.h @@ -307,6 +307,7 @@ # define init_i18nl10n(a) Perl_init_i18nl10n(aTHX_ a) # define init_stacks() Perl_init_stacks(aTHX) # define init_tm(a) Perl_init_tm(aTHX_ a) +# define instr Perl_instr # define intro_my() Perl_intro_my(aTHX) # define isC9_STRICT_UTF8_CHAR Perl_isC9_STRICT_UTF8_CHAR # define isSTRICT_UTF8_CHAR Perl_isSTRICT_UTF8_CHAR diff --git a/mathoms.c b/mathoms.c index d6288c903d..9592a4fe87 100644 --- a/mathoms.c +++ b/mathoms.c @@ -802,17 +802,6 @@ Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen)); } -/* return ptr to little string in big string, NULL if not found */ -/* The original version of this routine was donated by Corey Satten. */ - -char * -Perl_instr(const char *big, const char *little) -{ - PERL_ARGS_ASSERT_INSTR; - - return instr(big, little); -} - SV * Perl_newSVsv(pTHX_ SV *const old) { diff --git a/proto.h b/proto.h index 329c5ad318..b64d33d759 100644 --- a/proto.h +++ b/proto.h @@ -1797,6 +1797,11 @@ Perl_init_uniprops(pTHX) __attribute__visibility__("hidden"); #define PERL_ARGS_ASSERT_INIT_UNIPROPS +/* PERL_CALLCONV char * +Perl_instr(const char *big, const char *little) + __attribute__warn_unused_result__ + __attribute__pure__; */ + PERL_CALLCONV U32 Perl_intro_my(pTHX); #define PERL_ARGS_ASSERT_INTRO_MY @@ -5809,13 +5814,6 @@ PERL_CALLCONV SV ** Perl_hv_store_flags(pTHX_ HV *hv, const char *key, I32 klen, SV *val, U32 hash, int flags); # define PERL_ARGS_ASSERT_HV_STORE_FLAGS -PERL_CALLCONV char * -Perl_instr(const char *big, const char *little) - __attribute__warn_unused_result__ - __attribute__pure__; -# define PERL_ARGS_ASSERT_INSTR \ - assert(big); assert(little) - PERL_CALLCONV STRLEN Perl_is_utf8_char_buf(const U8 *buf, const U8 *buf_end); # define PERL_ARGS_ASSERT_IS_UTF8_CHAR_BUF \ diff --git a/util.h b/util.h index 84d0e9f1c8..9ef5e38fcb 100644 --- a/util.h +++ b/util.h @@ -241,7 +241,7 @@ returning NULL if not found. The terminating NUL bytes are not compared. */ -#define instr(haystack, needle) strstr((char *) haystack, (char *) needle) +#define Perl_instr(haystack, needle) strstr((char *) haystack, (char *) needle) #ifdef HAS_MEMMEM # define ninstr(big, bigend, little, lend) \