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; \
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php