cvs: php4 /ext/standard string.c

From: Date: Sun, 05 Aug 2001 23:08:19 +0000
Subject: cvs: php4 /ext/standard string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6590@lists.php.net to get a copy of this message
jeroen Sun Aug 5 19:08:19 2001 EDT Modified files: /php4/ext/standard string.c Log: Removed some duplicate code out of addclashes # Not TSRM-safe, I am afraid... @- addcslashes now warns when charlist is invalid. The returned string @ remained the same (Jeroen) Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.220 php4/ext/standard/string.c:1.221 --- php4/ext/standard/string.c:1.220 Sun Aug 5 16:25:40 2001 +++ php4/ext/standard/string.c Sun Aug 5 19:08:19 2001 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.220 2001/08/05 20:25:40 sebastian Exp $ */ +/* $Id: string.c,v 1.221 2001/08/05 23:08:19 jeroen Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2316,6 +2316,8 @@ */ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_free, char *what, int wlength) { + /* TSRMLS_FETCH(); (causes parse error -> ?) */ + char flags[256]; char *new_str = emalloc((length?length:(length=strlen(str)))*4+1); char *source,*target; @@ -2331,14 +2333,7 @@ length = strlen(str); } - memset(flags, '\0', sizeof(flags)); - for (source=what,end=source+wlength; (c=*source) || source<end; source++) { - if (source+3<end && *(source+1) == '.' && *(source+2) == '.' && (unsigned char)*(source+3)>=(unsigned char)c) { - memset(flags+c, 1, (unsigned char)*(source+3)-(unsigned char)c+1); - source+=3; - } else - flags[(unsigned char)c]=1; - } + php_charmask(what, wlength, flags TSRMLS_CC); for (source=str,end=source+length,target=new_str; (c=*source) || source<end; source++) { if (flags[(unsigned char)c]) {

« previous php.cvs (#6590) next »