From dfa580fbfb09708158b30f669e9139c57ee90ead Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 13 Feb 2015 11:21:06 +0100 Subject: [PATCH] partially replace the loop with a duff device --- php_http_utf8.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/php_http_utf8.h b/php_http_utf8.h index c7bcb49..d67910f 100644 --- a/php_http_utf8.h +++ b/php_http_utf8.h @@ -595,9 +595,9 @@ static inline size_t utf8towc(unsigned *wc, const unsigned char *uc, size_t len) static inline zend_bool isualpha(unsigned ch) { - unsigned i, j; + unsigned i = 0, j; - for (i = 0; i < sizeof(utf8_ranges)/sizeof(utf8_range_t); ++i) { + PHP_HTTP_DUFF(sizeof(utf8_ranges)/sizeof(utf8_range_t), if (utf8_ranges[i].start == ch) { return 1; } else if (utf8_ranges[i].start <= ch && utf8_ranges[i].end >= ch) { @@ -611,7 +611,8 @@ static inline zend_bool isualpha(unsigned ch) } return 0; } - } + ++i; + ); return 0; } -- 2.30.2