summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-02-17 20:00:15 -0700
committerKarl Williamson <khw@cpan.org>2022-05-31 06:52:33 -0600
commitff00d73bbce9a135c78de0d69548d7fad0dd02ad (patch)
tree2b6e600dca53a6518eaf8fb4290f1b0053742f88 /handy.h
parent8fcaedaae577eaca064a33debe61acb344a48a33 (diff)
downloadperl-ff00d73bbce9a135c78de0d69548d7fad0dd02ad.tar.gz
Make STRLENs() available to core
This may cause problems when not used correctly; so continue to restrict it.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/handy.h b/handy.h
index 2e431c9416..0ddbd28ab2 100644
--- a/handy.h
+++ b/handy.h
@@ -2827,6 +2827,12 @@ last-inclusive range.
#define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0]))
#define C_ARRAY_END(a) ((a) + C_ARRAY_LENGTH(a))
+#if defined(PERL_CORE) || defined(PERL_EXT_RE_BUILD)
+/* strlen() of a literal string constant. Restricting this to core, in part
+ * because it can generate compiler warnings about comparing unlike signs */
+# define STRLENs(s) (sizeof("" s "") - 1)
+#endif
+
#ifdef NEED_VA_COPY
# ifdef va_copy
# define Perl_va_copy(s, d) va_copy(d, s)