]> granicus.if.org Git - php/commitdiff
Optimize strtolower()/strtoupper()
authorYoshio HANAWA <y@hnw.jp>
Sun, 13 Dec 2015 05:22:50 +0000 (14:22 +0900)
committerYoshio HANAWA <y@hnw.jp>
Sun, 13 Dec 2015 05:22:50 +0000 (14:22 +0900)
ext/standard/string.c

index 3922ff497d67e6e7c694ba93fc98cb7fad250a74..01c7c6dffe189138e4fddaa3be8970975220d68b 100644 (file)
@@ -1439,7 +1439,7 @@ PHPAPI zend_string *php_string_toupper(zend_string *s)
        e = c + ZSTR_LEN(s);
 
        while (c < e) {
-               if (!isupper(*c)) {
+               if (islower(*c)) {
                        register unsigned char *r;
                        zend_string *res = zend_string_alloc(ZSTR_LEN(s), 0);
 
@@ -1508,7 +1508,7 @@ PHPAPI zend_string *php_string_tolower(zend_string *s)
        e = c + ZSTR_LEN(s);
 
        while (c < e) {
-               if (!islower(*c)) {
+               if (isupper(*c)) {
                        register unsigned char *r;
                        zend_string *res = zend_string_alloc(ZSTR_LEN(s), 0);