summaryrefslogtreecommitdiff
path: root/mathoms.c
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2016-04-06 20:59:12 -0500
committerKarl Williamson <khw@cpan.org>2016-05-09 11:19:05 -0600
commit534dad482495d5659cc3fdec2b8189067f5c84e5 (patch)
tree049e2b9707d391de3676ae9fa17129d71ad5c3ec /mathoms.c
parent4ee010a8de7e086d97cebe73ad4c69d91d1ae7f0 (diff)
downloadperl-534dad482495d5659cc3fdec2b8189067f5c84e5.tar.gz
Finish mathomizing Perl_instr.
fea1d2dd5d210564d4 turned instr into a macro. It also left the actual function in util.c while commenting out the prototype in proto.h (via the m flag in embed.fnc). A function compiled without a prototype under C++ does not get declared with extern "C" and thus gets mangled, which breaks the build with a strict linker (VMS, possibly AIX) because the expected symbol name is no longer produced. Without a strict linker, it just breaks the binary compatibility that was presumably the nominal reason for leaving the function around in the first place. So move the function into mathoms.c and put its prototype in the extern "C"-guarded section at the top of the same file. We also have to fake the PERL_ARGS_ASSERT_INSTR macro since its original declaration in proto.h is commented out but the porting test t/porting/args_assert.t will take revenge if it doesn't find the macro being used somewhere.
Diffstat (limited to 'mathoms.c')
-rw-r--r--mathoms.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mathoms.c b/mathoms.c
index 3187782a8c..d530cc03e0 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -107,6 +107,9 @@ PERL_CALLCONV UV Perl_to_utf8_title(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV UV Perl_to_utf8_fold(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp);
PERL_CALLCONV SV *Perl_sv_mortalcopy(pTHX_ SV *const oldstr);
+PERL_CALLCONV char* Perl_instr(const char* big, const char* little)
+ __attribute__warn_unused_result__
+ __attribute__pure__;
/* ref() is now a macro using Perl_doref;
* this version provided for binary compatibility only.
@@ -1808,6 +1811,23 @@ Perl_pad_compname_type(pTHX_ const PADOFFSET po)
return PAD_COMPNAME_TYPE(po);
}
+/* now a macro */
+/* return ptr to little string in big string, NULL if not found */
+/* This routine was donated by Corey Satten. */
+
+char *
+Perl_instr(const char *big, const char *little)
+{
+ /* Porting tests require this macro to be used even though it doesn't exist
+ * (except for the commented-out version in proto.h). So provide a commented-out
+ * "use" of the prototype and supply a real version of what it expanded to.
+ PERL_ARGS_ASSERT_INSTR;
+ */
+ assert(big);
+ assert(little);
+
+ return strstr((char*)big, (char*)little);
+}
END_EXTERN_C