From: Jeroen van Wolffelaar Date: Sun, 5 Aug 2001 23:08:19 +0000 (+0000) Subject: Removed some duplicate code out of addclashes X-Git-Tag: PRE_ENGINE2_SPLIT~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dce78d75d6aa0cec156f85fded646e4c14ce248a;p=php 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) --- diff --git a/ext/standard/string.c b/ext/standard/string.c index bcbdccda9a..7cba634ce5 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2316,6 +2316,8 @@ PHPAPI void php_stripcslashes(char *str, int *len) */ 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 @@ PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int should_ length = strlen(str); } - memset(flags, '\0', sizeof(flags)); - for (source=what,end=source+wlength; (c=*source) || source=(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