summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-09-16 06:41:09 -0600
committerKarl Williamson <khw@cpan.org>2021-09-16 06:47:19 -0600
commite72852772d35fa07c6f4def68643512939de4443 (patch)
tree563e83dfa721cfe06cd28128832001b56169c896 /utf8.h
parent3c7193497828fab68ec01b4628cedefeefb65f69 (diff)
downloadperl-e72852772d35fa07c6f4def68643512939de4443.tar.gz
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.
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h12
1 files changed, 4 insertions, 8 deletions
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))