This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
handy.h: Guard controversial macro name
authorKarl Williamson <khw@cpan.org>
Mon, 20 Feb 2017 05:14:53 +0000 (22:14 -0700)
committerKarl Williamson <khw@cpan.org>
Mon, 20 Feb 2017 05:45:00 +0000 (22:45 -0700)
This is so their use cannot spread easily until we have sorted things
out in 5.27

handy.h

diff --git a/handy.h b/handy.h
index 4d2f4bc..80f9cf4 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -485,8 +485,13 @@ Returns zero if non-equal, or non-zero if equal.
 #define strnNE(s1,s2,l) (strncmp(s1,s2,l))
 #define strnEQ(s1,s2,l) (!strncmp(s1,s2,l))
 
+/* These names are controversial, so guarding against their being used in more
+ * places than they already are.  strBEGs and StrStartsWith are potential
+ * candidates */
+#if defined(PERL_IN_DOIO_C) || defined(PERL_IN_GV_C) || defined(PERL_IN_HV_C) || defined(PERL_IN_LOCALE_C) || defined(PERL_IN_PERL_C) || defined(PERL_IN_TOKE_C) || defined(PERL_EXT)
 #define strNEs(s1,s2) (strncmp(s1,"" s2 "", sizeof(s2)-1))
 #define strEQs(s1,s2) (!strncmp(s1,"" s2 "", sizeof(s2)-1))
+#endif
 
 #ifdef HAS_MEMCMP
 #  define memNE(s1,s2,l) (memcmp(s1,s2,l))