In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/393aa92a477cb2f9e975ca866c8621505b7d93f2?hp=1656665e748b80ad0727244ca0eae788f521f64f>

- Log -----------------------------------------------------------------
commit 393aa92a477cb2f9e975ca866c8621505b7d93f2
Author: Karl Williamson <[email protected]>
Date:   Fri Apr 8 13:46:24 2016 -0600

    POSIX.pod: Add some caveats about strcoll(), strxfrm()

M       ext/POSIX/lib/POSIX.pod

commit 534dad482495d5659cc3fdec2b8189067f5c84e5
Author: Craig A. Berry <[email protected]>
Date:   Wed Apr 6 20:59:12 2016 -0500

    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.

M       mathoms.c
M       util.c

commit 4ee010a8de7e086d97cebe73ad4c69d91d1ae7f0
Author: Karl Williamson <[email protected]>
Date:   Fri Apr 8 12:34:09 2016 -0600

    Reinstate "Make instr() a macro"
    
    This reverts commit 2e08dfb2b133af0fbcb4346f8d096ca68454ca54, thus
    reinstating the commit it reverted.   This was delayed until 5.25.  The
    next commit will solve some problems with c++ that this commit causes

M       embed.fnc
M       embed.h
M       proto.h
M       util.h
-----------------------------------------------------------------------

Summary of changes:
 embed.fnc               |  2 +-
 embed.h                 |  1 -
 ext/POSIX/lib/POSIX.pod |  8 ++++++++
 mathoms.c               | 20 ++++++++++++++++++++
 proto.h                 |  4 ++--
 util.c                  | 12 ------------
 util.h                  |  2 ++
 7 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/embed.fnc b/embed.fnc
index a64ffba..7f60ae1 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 42c65b2..c24eb31 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/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod
index 1d263a7..840f04b 100644
--- a/ext/POSIX/lib/POSIX.pod
+++ b/ext/POSIX/lib/POSIX.pod
@@ -1671,6 +1671,10 @@ for collating (comparing) strings transformed using
 the C<strxfrm()> function.  Not really needed since
 Perl can do this transparently, see L<perllocale>.
 
+Beware that in a UTF-8 locale, anything you pass to this function must
+be in UTF-8; and when not in a UTF-8 locale, anything passed must not be
+UTF-8 encoded.
+
 =item C<strcpy>
 
 Not implemented.  C<strcpy()> is C-specific, use C<=> instead, see L<perlop>.
@@ -1843,6 +1847,10 @@ Used in conjunction with the C<strcoll()> function, see 
L</strcoll>.
 Not really needed since Perl can do this transparently, see
 L<perllocale>.
 
+Beware that in a UTF-8 locale, anything you pass to this function must
+be in UTF-8; and when not in a UTF-8 locale, anything passed must not be
+UTF-8 encoded.
+
 =item C<sysconf>
 
 Retrieves values of system configurable variables.
diff --git a/mathoms.c b/mathoms.c
index 3187782..d530cc0 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
 
diff --git a/proto.h b/proto.h
index fb4ee29..4beb21b 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.c b/util.c
index 89c44e7..447a19f 100644
--- a/util.c
+++ b/util.c
@@ -551,18 +551,6 @@ Perl_delimcpy(char *to, const char *toend, const char 
*from, const char *fromend
     return (char *)from;
 }
 
-/* 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)
-{
-
-    PERL_ARGS_ASSERT_INSTR;
-
-    return strstr((char*)big, (char*)little);
-}
-
 /*
 =head1 Miscellaneous Functions
 
diff --git a/util.h b/util.h
index 3310b11..3a74bd0 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:
  */

--
Perl5 Master Repository

Reply via email to