diff options
author | Karl Williamson <khw@cpan.org> | 2019-10-02 16:37:17 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-10-06 10:18:17 -0600 |
commit | cb15eeb248da9580d55c2a91ed5932642006573d (patch) | |
tree | 4ff38548d8039e54ed5ea8c994ee37ac3b35599a /utf8.h | |
parent | 703512f58a2dc33b998199d89fec7b009f3be7aa (diff) | |
download | perl-cb15eeb248da9580d55c2a91ed5932642006573d.tar.gz |
utf8.h: Make sure macros not called with a ptr
By doing an '| 0' with a parameter in a macro expansion, a C syntax
error will be generated. This is free protection.
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -195,11 +195,11 @@ adding no time nor space requirements to the implementation. */ #ifdef PERL_SMALL_MACRO_BUFFER -#define NATIVE_TO_LATIN1(ch) ((U8)(ch)) -#define LATIN1_TO_NATIVE(ch) ((U8)(ch)) +# define NATIVE_TO_LATIN1(ch) ((U8)(ch)) +# define LATIN1_TO_NATIVE(ch) ((U8)(ch)) #else -#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))) +# define NATIVE_TO_LATIN1(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ((ch) | 0))) +# define LATIN1_TO_NATIVE(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ((ch) | 0))) #endif /* I8 is an intermediate version of UTF-8 used only in UTF-EBCDIC. We thus @@ -212,12 +212,12 @@ adding no time nor space requirements to the implementation. #define NATIVE_UTF8_TO_I8(ch) ((U8) (ch)) #define I8_TO_NATIVE_UTF8(ch) ((U8) (ch)) #else -#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 NATIVE_UTF8_TO_I8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ((ch) | 0))) +#define I8_TO_NATIVE_UTF8(ch) (__ASSERT_(FITS_IN_8_BITS(ch)) ((U8) ((ch) | 0))) #endif -#define UNI_TO_NATIVE(ch) ((UV) (ch)) -#define NATIVE_TO_UNI(ch) ((UV) (ch)) +#define UNI_TO_NATIVE(ch) ((UV) ((ch) | 0)) +#define NATIVE_TO_UNI(ch) ((UV) ((ch) | 0)) /* |