Skip to content

Commit fea1d2d

Browse files
committed
Make instr() a macro
... thus avoiding a function call overhead
1 parent d708a1f commit fea1d2d

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ p |void |init_debugger
647647
Ap |void |init_stacks
648648
Ap |void |init_tm |NN struct tm *ptm
649649
: Used in perly.y
650-
AnpPR |char* |instr |NN const char* big|NN const char* little
650+
AbmnpPR |char* |instr |NN const char* big|NN const char* little
651651
: Used in sv.c
652652
p |bool |io_close |NN IO* io|NULLOK GV *gv \
653653
|bool not_implicit|bool warn_on_fail

embed.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@
238238
#define init_i18nl14n(a) Perl_init_i18nl14n(aTHX_ a)
239239
#define init_stacks() Perl_init_stacks(aTHX)
240240
#define init_tm(a) Perl_init_tm(aTHX_ a)
241-
#define instr Perl_instr
242241
#define intro_my() Perl_intro_my(aTHX)
243242
#define isALNUM_lazy(a) Perl_isALNUM_lazy(aTHX_ a)
244243
#define isIDFIRST_lazy(a) Perl_isIDFIRST_lazy(aTHX_ a)

proto.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,9 +1244,9 @@ PERL_CALLCONV void Perl_init_stacks(pTHX);
12441244
PERL_CALLCONV void Perl_init_tm(pTHX_ struct tm *ptm);
12451245
#define PERL_ARGS_ASSERT_INIT_TM \
12461246
assert(ptm)
1247-
PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
1247+
/* PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
12481248
__attribute__warn_unused_result__
1249-
__attribute__pure__;
1249+
__attribute__pure__; */
12501250
#define PERL_ARGS_ASSERT_INSTR \
12511251
assert(big); assert(little)
12521252

util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ means arg not present, 1 is empty string/null byte */
229229
# define HS_CXT cv
230230
#endif
231231

232+
#define instr(haystack, needle) strstr(haystack, needle)
233+
232234
/*
233235
* ex: set ts=8 sts=4 sw=4 et:
234236
*/

0 commit comments

Comments
 (0)