summaryrefslogtreecommitdiff
path: root/utf8.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-06-01 10:44:08 -0600
committerJames E Keenan <jkeenan@cpan.org>2017-06-01 12:56:23 -0400
commit4e1ed312da261450ba45a56e7b6756a873678f52 (patch)
tree0369f121a87346343272e4ac827628a564158634 /utf8.h
parent935d8e7269ade03fb8f5de3c2c0ffcf649231353 (diff)
downloadperl-4e1ed312da261450ba45a56e7b6756a873678f52.tar.gz
utf8.h: Add parens around macro param in expansion
a6951642ede4abe605dcf0e94b74948e0a60a56b added an assertion to find bugs in calling macros, and so far, instead, it found a bug in a macro. A parameter needs to be enclosed in parens in case it is an expression, so that precedence works.
Diffstat (limited to 'utf8.h')
-rw-r--r--utf8.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/utf8.h b/utf8.h
index b2e338a80a..7b2ba14aa9 100644
--- a/utf8.h
+++ b/utf8.h
@@ -540,9 +540,10 @@ encoded as UTF-8. C<cp> is a native (ASCII or EBCDIC) code point if less than
& UTF_CONTINUATION_MASK))
/* This works in the face of malformed UTF-8. */
-#define UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, e) (UTF8_IS_DOWNGRADEABLE_START(*s) \
- && ( (e) - (s) > 1) \
- && UTF8_IS_CONTINUATION(*((s)+1)))
+#define UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, e) \
+ ( UTF8_IS_DOWNGRADEABLE_START(*(s)) \
+ && ( (e) - (s) > 1) \
+ && UTF8_IS_CONTINUATION(*((s)+1)))
/* Number of bytes a code point occupies in UTF-8. */
#define NATIVE_SKIP(uv) UVCHR_SKIP(uv)