From: Michael Wallner Date: Fri, 13 Feb 2015 10:21:06 +0000 (+0100) Subject: partially replace the loop with a duff device X-Git-Tag: RELEASE_2_3_0_RC1~31 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dfa580fbfb09708158b30f669e9139c57ee90ead;p=m6w6%2Fext-http partially replace the loop with a duff device --- 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; }