cvs: php4 /ext/standard string.c

From: Date: Sun, 25 Aug 2002 19:08:07 +0000
Subject: cvs: php4 /ext/standard string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13670@lists.php.net to get a copy of this message
iliaa Sun Aug 25 15:08:07 2002 EDT Modified files: /php4/ext/standard string.c Log: Slight optimization of php_strtoupper & php_strtoupper functions. Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.285 php4/ext/standard/string.c:1.286 --- php4/ext/standard/string.c:1.285 Sun Aug 25 06:26:58 2002 +++ php4/ext/standard/string.c Sun Aug 25 15:08:07 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.285 2002/08/25 10:26:58 wez Exp $ */ +/* $Id: string.c,v 1.286 2002/08/25 19:08:07 iliaa Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -942,14 +942,14 @@ */ 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 @@ */ 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; }

« previous php.cvs (#13670) next »