cvs: php-src /ext/ctype ctype.c
| From: | Ilia Alshanetsky | Date: | Tue, 30 Nov 2004 16:55:55 +0000 |
| Subject: | cvs: php-src /ext/ctype ctype.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-29367@lists.php.net to get a copy of this message | ||
iliaa Tue Nov 30 11:55:55 2004 EDT
Modified files:
/php-src/ext/ctype ctype.c
Log:
Fixed bug #30945 (make ctype_* functions return FALSE on empty strings).
Slight performance improvement of multi-byte string checking via ctype_*.
http://cvs.php.net/diff.php/php-src/ext/ctype/ctype.c?r1=1.32&r2=1.33&ty=u
Index: php-src/ext/ctype/ctype.c
diff -u php-src/ext/ctype/ctype.c:1.32 php-src/ext/ctype/ctype.c:1.33
--- php-src/ext/ctype/ctype.c:1.32 Wed Sep 29 21:22:56 2004
+++ php-src/ext/ctype/ctype.c Tue Nov 30 11:55:55 2004
@@ -106,11 +106,11 @@
convert_to_string(c); \
case IS_STRING: \
{ \
- char *p; \
- int n, len; \
- p=Z_STRVAL_P(c); \
- len = Z_STRLEN_P(c); \
- for(n=0;n<len;n++) { \
+ char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \
+ if (e == p) { \
+ RETURN_FALSE; \
+ } \
+ while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) RETURN_FALSE; \
} \
RETURN_TRUE; \