summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJeroen van Wolffelaar <jeroen@php.net>2001-08-05 23:08:19 +0000
committerJeroen van Wolffelaar <jeroen@php.net>2001-08-05 23:08:19 +0000
commitdce78d75d6aa0cec156f85fded646e4c14ce248a (patch)
treead64a5a8ad9644b1efa3d78d1a80522c8d6d67f5 /ext
parentb3a7b945faddfef40f0103d43d993910da5b3355 (diff)
downloadphp-git-dce78d75d6aa0cec156f85fded646e4c14ce248a.tar.gz
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)
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/string.c11
1 files changed, 3 insertions, 8 deletions
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<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]) {