summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-03-11 16:22:49 -0700
committerKarl Williamson <khw@cpan.org>2016-03-17 21:31:03 -0600
commitfea1d2dd5d210564d442a09fe034b62f262f35f9 (patch)
treef6ce46c0c616f6e619a2e038777768398e070c2a
parentd708a1fbecea9996703282b58186c8bb4e429663 (diff)
downloadperl-fea1d2dd5d210564d442a09fe034b62f262f35f9.tar.gz
Make instr() a macro
... thus avoiding a function call overhead
-rw-r--r--embed.fnc2
-rw-r--r--embed.h1
-rw-r--r--proto.h4
-rw-r--r--util.h2
4 files changed, 5 insertions, 4 deletions
diff --git a/embed.fnc b/embed.fnc
index 5e2b061527..049f6c180f 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -647,7 +647,7 @@ p |void |init_debugger
Ap |void |init_stacks
Ap |void |init_tm |NN struct tm *ptm
: Used in perly.y
-AnpPR |char* |instr |NN const char* big|NN const char* little
+AbmnpPR |char* |instr |NN const char* big|NN const char* little
: Used in sv.c
p |bool |io_close |NN IO* io|NULLOK GV *gv \
|bool not_implicit|bool warn_on_fail
diff --git a/embed.h b/embed.h
index a2cc3782a5..ab76937da7 100644
--- a/embed.h
+++ b/embed.h
@@ -238,7 +238,6 @@
#define init_i18nl14n(a) Perl_init_i18nl14n(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 isALNUM_lazy(a) Perl_isALNUM_lazy(aTHX_ a)
#define isIDFIRST_lazy(a) Perl_isIDFIRST_lazy(aTHX_ a)
diff --git a/proto.h b/proto.h
index 0de5c31cf9..88078676d6 100644
--- a/proto.h
+++ b/proto.h
@@ -1244,9 +1244,9 @@ PERL_CALLCONV void Perl_init_stacks(pTHX);
PERL_CALLCONV void Perl_init_tm(pTHX_ struct tm *ptm);
#define PERL_ARGS_ASSERT_INIT_TM \
assert(ptm)
-PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
+/* PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
__attribute__warn_unused_result__
- __attribute__pure__;
+ __attribute__pure__; */
#define PERL_ARGS_ASSERT_INSTR \
assert(big); assert(little)
diff --git a/util.h b/util.h
index 3310b119d8..3a74bd02bd 100644
--- a/util.h
+++ b/util.h
@@ -229,6 +229,8 @@ means arg not present, 1 is empty string/null byte */
# define HS_CXT cv
#endif
+#define instr(haystack, needle) strstr(haystack, needle)
+
/*
* ex: set ts=8 sts=4 sw=4 et:
*/