]> granicus.if.org Git - php/commitdiff
- Updated addslashes(): add codepoints directly rather than with zend_codepoint_to_uc...
authorRolland Santimano <rolland@php.net>
Thu, 29 Sep 2005 09:33:38 +0000 (09:33 +0000)
committerRolland Santimano <rolland@php.net>
Thu, 29 Sep 2005 09:33:38 +0000 (09:33 +0000)
ext/standard/string.c

index 4cc057312610c7656bba27ef4e91d11a261a5c9c..ab6dd8f209fe57d7f1c21222ec8b336f0b420457 100644 (file)
@@ -3817,12 +3817,12 @@ PHPAPI UChar *php_u_addslashes_ex(UChar *str, int32_t length, int32_t *new_lengt
                        U16_NEXT(str, i, length, ch);
                        switch (ch) {
                        case '\0':
-                               buf_len += zend_codepoint_to_uchar('\\', buf+buf_len);
-                               buf_len += zend_codepoint_to_uchar('0', buf+buf_len);
+                               *(buf+buf_len) = (UChar)0x5C; buf_len++; /* \ */
+                               *(buf+buf_len) = (UChar)0x30; buf_len++; /* 0 */
                                break;
                        case '\'':
-                               buf_len += zend_codepoint_to_uchar('\'', buf+buf_len);
-                               buf_len += zend_codepoint_to_uchar('\'', buf+buf_len);
+                               *(buf+buf_len) = (UChar)0x27; buf_len++; /* ' */
+                               *(buf+buf_len) = (UChar)0x27; buf_len++; /* ' */
                                break;
                        default:
                                buf_len += zend_codepoint_to_uchar(ch, buf+buf_len);
@@ -3834,13 +3834,13 @@ PHPAPI UChar *php_u_addslashes_ex(UChar *str, int32_t length, int32_t *new_lengt
                        U16_NEXT(str, i, length, ch);
                        switch (ch) {
                        case '\0':
-                               buf_len += zend_codepoint_to_uchar('\\', buf+buf_len);
-                               buf_len += zend_codepoint_to_uchar('0', buf+buf_len);
+                               *(buf+buf_len) = (UChar)0x5C; buf_len++; /* \ */
+                               *(buf+buf_len) = (UChar)0x30; buf_len++; /* 0 */
                                break;
                        case '\'':
                        case '\"':
                        case '\\':
-                               buf_len += zend_codepoint_to_uchar('\\', buf+buf_len);
+                               *(buf+buf_len) = (UChar)0x5C; buf_len++; /* \ */
                                /* break is missing *intentionally* */
                        default:
                                buf_len += zend_codepoint_to_uchar(ch, buf+buf_len);