From e72852772d35fa07c6f4def68643512939de4443 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 16 Sep 2021 06:41:09 -0600 Subject: utf8.h: Rmv redundant asserts These macros asserted both that the passed in parameter occupied no more than a byte, and that it wasn't a pointer. But pointers occupy more than a byte, so if it passes the first check, meaning it occupies only a byte, it will necessarily pass the second, making that check unnecessary. --- utf8.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'utf8.h') diff --git a/utf8.h b/utf8.h index 2f2be9ebac..1d172cd626 100644 --- a/utf8.h +++ b/utf8.h @@ -199,10 +199,8 @@ adding no time nor space requirements to the implementation. =cut */ -#define NATIVE_TO_LATIN1(ch) \ - (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ASSERT_NOT_PTR(ch))) -#define LATIN1_TO_NATIVE(ch) \ - (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ASSERT_NOT_PTR(ch))) +#define NATIVE_TO_LATIN1(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch))) +#define LATIN1_TO_NATIVE(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch))) /* I8 is an intermediate version of UTF-8 used only in UTF-EBCDIC. We thus * consider it to be identical to UTF-8 on ASCII platforms. Strictly speaking @@ -210,10 +208,8 @@ adding no time nor space requirements to the implementation. * because they are 8-bit encodings that serve the same purpose in Perl, and * rarely do we need to distinguish them. The term "NATIVE_UTF8" applies to * whichever one is applicable on the current platform */ -#define NATIVE_UTF8_TO_I8(ch) \ - (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ASSERT_NOT_PTR(ch))) -#define I8_TO_NATIVE_UTF8(ch) \ - (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ASSERT_NOT_PTR(ch))) +#define NATIVE_UTF8_TO_I8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch))) +#define I8_TO_NATIVE_UTF8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) (ch))) #define UNI_TO_NATIVE(ch) ((UV) ASSERT_NOT_PTR(ch)) #define NATIVE_TO_UNI(ch) ((UV) ASSERT_NOT_PTR(ch)) -- cgit v1.2.1