diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-14 17:17:38 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-14 17:18:05 +0200 |
| commit | 4fb705a03dc73bfafbd81bd1ba23b30b0ec2a502 (patch) | |
| tree | 4beeeb15cfc1f13918c0ca560c9346320795ad12 /ext | |
| parent | 489a51bff077671e77f29b01f2575c54c1ef452b (diff) | |
| download | php-git-4fb705a03dc73bfafbd81bd1ba23b30b0ec2a502.tar.gz | |
Add zend_string_concat2 API
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ffi/ffi.c | 8 | ||||
| -rw-r--r-- | ext/pcre/php_pcre.c | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c index 95ae8e3711..ba1130a64e 100644 --- a/ext/ffi/ffi.c +++ b/ext/ffi/ffi.c @@ -1605,12 +1605,8 @@ static zend_string *zend_ffi_get_class_name(zend_string *prefix, const zend_ffi_ if (!zend_ffi_ctype_name(&buf, type)) { return zend_string_copy(prefix); } else { - zend_string *name = zend_string_alloc(ZSTR_LEN(prefix) + 1 + buf.end - buf.start, 0); - memcpy(ZSTR_VAL(name), ZSTR_VAL(prefix), ZSTR_LEN(prefix)); - ZSTR_VAL(name)[ZSTR_LEN(prefix)] = ':'; - memcpy(ZSTR_VAL(name) + ZSTR_LEN(prefix) + 1, buf.start, buf.end - buf.start); - ZSTR_VAL(name)[ZSTR_LEN(name)] = 0; - return name; + return zend_string_concat3( + ZSTR_VAL(prefix), ZSTR_LEN(prefix), ":", 1, buf.start, buf.end - buf.start); } } /* }}} */ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 26ed8b43e7..a5e806b30c 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -597,9 +597,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in if (locale_aware && BG(locale_string) && (ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) { - key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0); - memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1); - memcpy(ZSTR_VAL(key) + ZSTR_LEN(BG(locale_string)), ZSTR_VAL(regex), ZSTR_LEN(regex) + 1); + key = zend_string_concat2( + ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)), + ZSTR_VAL(regex), ZSTR_LEN(regex)); } else { key = regex; } |
