X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=src%2Fphp_http_utf8.h;h=02fd8d762095e385ee7795daa75c6853636ce69a;hp=f9008032dff0eea98abc8c59cb1134b35ab3b7c3;hb=13662c61792685435496cd25c95ee1c1950cd9d7;hpb=64619407ab97f25d63405c3536a3936679e328d2 diff --git a/src/php_http_utf8.h b/src/php_http_utf8.h index f900803..02fd8d7 100644 --- a/src/php_http_utf8.h +++ b/src/php_http_utf8.h @@ -595,24 +595,25 @@ static inline size_t utf8towc(unsigned *wc, const unsigned char *uc, size_t len) static inline zend_bool isualpha(unsigned ch) { - unsigned i = 0, j; + unsigned j; + const utf8_range_t *u = &utf8_ranges[0], *e = &utf8_ranges[sizeof(utf8_ranges)/sizeof(utf8_range_t)-1]; - PHP_HTTP_DUFF(sizeof(utf8_ranges)/sizeof(utf8_range_t), - if (utf8_ranges[i].start == ch) { + do { + if (u->start == ch) { return 1; - } else if (utf8_ranges[i].start <= ch && utf8_ranges[i].end >= ch) { - if (utf8_ranges[i].step == 1) { + } else if (u->start <= ch && u->end >= ch) { + if (u->step == 1) { return 1; } - for (j = utf8_ranges[i].start; j <= utf8_ranges[i].end; j+= utf8_ranges[i].step) { + for (j = u->start; j <= u->end; j+= u->step) { if (ch == j) { return 1; } } return 0; } - ++i; - ); + } while (++u != e); + return 0; }