diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2002-08-25 19:08:07 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2002-08-25 19:08:07 +0000 |
commit | 64ef43ecd42c19b6489b495d9a4da2efdf4ff999 (patch) | |
tree | a2550aae6abc279272e8cc2663b0d1d506a1ca16 | |
parent | 412c2ba7a39f78352de09ea8815e306ca82f2d83 (diff) | |
download | php-git-64ef43ecd42c19b6489b495d9a4da2efdf4ff999.tar.gz |
Slight optimization of php_strtoupper & php_strtoupper functions.
-rw-r--r-- | ext/standard/string.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 68b3de8e84..8eb1167b8f 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -942,14 +942,14 @@ restore: */ PHPAPI char *php_strtoupper(char *s, size_t len) { - char *c; - int ch; - size_t i; - + char *c, *e; + c = s; - for (i=0; i<len; i++) { - ch = toupper((unsigned char)*c); - *c++ = ch; + e = c+len; + + while (c<e) { + *c = toupper(*c); + c++; } return s; } @@ -976,14 +976,14 @@ PHP_FUNCTION(strtoupper) */ PHPAPI char *php_strtolower(char *s, size_t len) { - register int ch; - char *c; - size_t i; - + char *c, *e; + c = s; - for (i=0; i<len; i++) { - ch = tolower((unsigned char)*c); - *c++ = ch; + e = c+len; + + while (c<e) { + *c = tolower(*c); + c++; } return s; } |