diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2015-06-29 16:44:54 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2015-06-29 16:44:54 +0300 |
| commit | 4bd22cf1c1d6a262fe2f026e082f2565433c53df (patch) | |
| tree | 09a65791a35333a58320a3d872f12496d3a6aecd /ext | |
| parent | 667e9bd4177e40a52b4f0cd6bfed5737c2694a47 (diff) | |
| download | php-git-4bd22cf1c1d6a262fe2f026e082f2565433c53df.tar.gz | |
Improved zend_string API (Francois Laupretre)
Squashed commit of the following:
commit d96eab8d79b75ac83d49d49ae4665f948d15a804
Author: Francois Laupretre <francois@tekwire.net>
Date: Fri Jun 26 01:23:31 2015 +0200
Use the new 'ZSTR' macros in the rest of the code.
Does not change anything to the generated code (thanks to compat macros) but cleaner.
commit b3526439104ac7a89a8e0c79dbebf33b22bd01b8
Author: Francois Laupretre <francois@tekwire.net>
Date: Thu Jun 25 13:45:06 2015 +0200
Improve zend_string API
Add missing methods
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/curl/interface.c | 2 | ||||
| -rw-r--r-- | ext/date/php_date.c | 4 | ||||
| -rw-r--r-- | ext/intl/breakiterator/breakiterator_iterators.cpp | 4 | ||||
| -rw-r--r-- | ext/intl/intl_error.c | 2 | ||||
| -rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 2 | ||||
| -rw-r--r-- | ext/opcache/ZendAccelerator.c | 6 | ||||
| -rw-r--r-- | ext/opcache/zend_file_cache.c | 6 | ||||
| -rw-r--r-- | ext/opcache/zend_persist.c | 4 | ||||
| -rw-r--r-- | ext/opcache/zend_persist_calc.c | 4 | ||||
| -rw-r--r-- | ext/pcre/php_pcre.c | 4 | ||||
| -rw-r--r-- | ext/session/mod_files.c | 4 | ||||
| -rw-r--r-- | ext/session/session.c | 2 | ||||
| -rw-r--r-- | ext/simplexml/simplexml.c | 2 | ||||
| -rw-r--r-- | ext/spl/spl_array.c | 2 | ||||
| -rw-r--r-- | ext/standard/array.c | 2 | ||||
| -rw-r--r-- | ext/standard/browscap.c | 2 | ||||
| -rw-r--r-- | ext/standard/file.c | 4 | ||||
| -rw-r--r-- | ext/standard/html.c | 2 | ||||
| -rw-r--r-- | ext/standard/http_fopen_wrapper.c | 2 | ||||
| -rw-r--r-- | ext/standard/math.c | 6 | ||||
| -rw-r--r-- | ext/standard/string.c | 28 | ||||
| -rw-r--r-- | ext/standard/var_unserializer.c | 33 | ||||
| -rw-r--r-- | ext/standard/var_unserializer.re | 4 | ||||
| -rw-r--r-- | ext/tidy/tidy.c | 4 | ||||
| -rw-r--r-- | ext/wddx/wddx.c | 4 |
25 files changed, 69 insertions, 70 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index cae8c46519..ea64294d0e 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -157,7 +157,7 @@ static void _php_curl_close(zend_resource *rsrc); #define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (zend_long) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v); #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : "")); -#define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : STR_EMPTY_ALLOC()); +#define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : ZSTR_EMPTY_ALLOC()); #define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s) -1 , (zval *) v); #if defined(PHP_WIN32) || defined(__GNUC__) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index be48b13a8c..3702e8e6d1 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1079,7 +1079,7 @@ static zend_string *date_format(char *format, size_t format_len, timelib_time *t int weekYearSet = 0; if (!format_len) { - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } if (localtime) { @@ -4212,7 +4212,7 @@ static zend_string *date_interval_format(char *format, size_t format_len, timeli char buffer[33]; if (!format_len) { - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } for (i = 0; i < format_len; i++) { diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp index 5bd77a5f2d..aa2f92763b 100644 --- a/ext/intl/breakiterator/breakiterator_iterators.cpp +++ b/ext/intl/breakiterator/breakiterator_iterators.cpp @@ -249,7 +249,7 @@ U_CFUNC zend_function *IntlPartsIterator_get_method(zend_object **object_ptr, ze ALLOCA_FLAG(use_heap); if (key == NULL) { - STR_ALLOCA_ALLOC(lc_method_name, method->len, use_heap); + ZSTR_ALLOCA_ALLOC(lc_method_name, method->len, use_heap); zend_str_tolower_copy(lc_method_name->val, method->val, method->len); } else { lc_method_name = Z_STR_P(key); @@ -270,7 +270,7 @@ U_CFUNC zend_function *IntlPartsIterator_get_method(zend_object **object_ptr, ze end: if (key == NULL) { - STR_ALLOCA_FREE(lc_method_name, use_heap); + ZSTR_ALLOCA_FREE(lc_method_name, use_heap); } return ret; diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index adbdd5afb8..a480c5ab11 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -135,7 +135,7 @@ zend_string * intl_error_get_message( intl_error* err ) zend_string *errMessage = 0; if( !err && !( err = intl_g_error_get( ) ) ) - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); uErrorName = u_errorName( err->code ); diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 1b6b3dec10..5e9c68d380 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -1358,7 +1358,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn) if (meta->name != mysqlnd_empty_string) { meta->sname = zend_string_init(meta->name, meta->name_length, packet->persistent_alloc); } else { - meta->sname = STR_EMPTY_ALLOC(); + meta->sname = ZSTR_EMPTY_ALLOC(); } meta->name = meta->sname->val; meta->name_length = meta->sname->len; diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 18e94287a2..dfcc32008d 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -343,7 +343,7 @@ zend_string *accel_new_interned_string(zend_string *str) idx = Z_NEXT(p->val); } - if (ZCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + str->len + 1) >= + if (ZCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(ZSTR_LEN(str))) >= ZCSG(interned_strings_end)) { /* no memory, return the same non-interned string */ zend_accel_error(ACCEL_LOG_WARNING, "Interned string buffer overflow"); @@ -356,7 +356,7 @@ zend_string *accel_new_interned_string(zend_string *str) ZCSG(interned_strings).nNumOfElements++; p = ZCSG(interned_strings).arData + idx; p->key = (zend_string*) ZCSG(interned_strings_top); - ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + str->len + 1); + ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); p->h = h; GC_REFCOUNT(p->key) = 1; #if 1 @@ -1973,7 +1973,7 @@ static void accel_reset_pcre_cache(void) ZEND_HASH_FOREACH_BUCKET(&PCRE_G(pcre_cache), p) { /* Remove PCRE cache entries with inconsistent keys */ - if (IS_INTERNED(p->key)) { + if (ZSTR_IS_INTERNED(p->key)) { p->key = NULL; zend_hash_del_bucket(&PCRE_G(pcre_cache), p); } diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 219bb50820..598e52a73d 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -199,14 +199,14 @@ static void *zend_file_cache_serialize_interned(zend_string *str, return ret; } - len = ZEND_MM_ALIGNED_SIZE(_STR_HEADER_SIZE + str->len + 1); + len = ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); ret = (void*)(info->str_size | Z_UL(1)); zend_shared_alloc_register_xlat_entry(str, ret); if (info->str_size + len > ((zend_string*)ZCG(mem))->len) { size_t new_len = info->str_size + len; ZCG(mem) = (void*)zend_string_realloc( (zend_string*)ZCG(mem), - ((_STR_HEADER_SIZE + 1 + new_len + 4095) & ~0xfff) - (_STR_HEADER_SIZE + 1), + ((_ZSTR_HEADER_SIZE + 1 + new_len + 4095) & ~0xfff) - (_ZSTR_HEADER_SIZE + 1), 0); } memcpy(((zend_string*)ZCG(mem))->val + info->str_size, str, len); @@ -717,7 +717,7 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm) mem = buf = emalloc(script->size); #endif - ZCG(mem) = zend_string_alloc(4096 - (_STR_HEADER_SIZE + 1), 0); + ZCG(mem) = zend_string_alloc(4096 - (_ZSTR_HEADER_SIZE + 1), 0); zend_shared_alloc_init_xlat_table(); if (!in_shm) { diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index af8936f104..bbcb20713b 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -39,7 +39,7 @@ zend_string_release(str); \ str = new_str; \ } else { \ - new_str = zend_accel_memdup((void*)str, _STR_HEADER_SIZE + (str)->len + 1); \ + new_str = zend_accel_memdup((void*)str, _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); \ zend_string_release(str); \ str = new_str; \ zend_string_hash_val(str); \ @@ -47,7 +47,7 @@ } \ } while (0) #define zend_accel_memdup_string(str) do { \ - str = zend_accel_memdup(str, _STR_HEADER_SIZE + (str)->len + 1); \ + str = zend_accel_memdup(str, _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))); \ zend_string_hash_val(str); \ GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \ } while (0) diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 98412109a5..d78cc59259 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -31,8 +31,8 @@ #define ADD_ARENA_SIZE(m) ZCG(current_persistent_script)->arena_size += ZEND_ALIGNED_SIZE(m) -# define ADD_STRING(str) \ - ADD_DUP_SIZE((str), _STR_HEADER_SIZE + (str)->len + 1) +# define ADD_STRING(str) ADD_DUP_SIZE((str), _ZSTR_STRUCT_SIZE(ZSTR_LEN(str))) + # define ADD_INTERNED_STRING(str, do_free) do { \ if (!IS_ACCEL_INTERNED(str)) { \ zend_string *tmp = accel_new_interned_string(str); \ diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 59a0aa569f..90c60f1b6f 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -503,7 +503,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) * as hash keys especually for this table. * See bug #63180 */ - if (!IS_INTERNED(regex) || !(GC_FLAGS(regex) & IS_STR_PERMANENT)) { + if (!ZSTR_IS_INTERNED(regex) || !(GC_FLAGS(regex) & IS_STR_PERMANENT)) { zend_string *str = zend_string_init(regex->val, regex->len, 1); GC_REFCOUNT(str) = 0; /* will be incremented by zend_hash_update_mem() */ str->h = regex->h; @@ -1339,7 +1339,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub uint32_t replace_idx; zend_string *subject_str = zval_get_string(subject); - /* FIXME: This might need to be changed to STR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */ + /* FIXME: This might need to be changed to ZSTR_EMPTY_ALLOC(). Check if this zval could be dtor()'ed somehow */ ZVAL_EMPTY_STRING(&empty_replace); /* If regex is an array */ diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 0ee4500010..a062f3e93f 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -477,7 +477,7 @@ PS_READ_FUNC(files) data->st_size = sbuf.st_size; if (sbuf.st_size == 0) { - *val = STR_EMPTY_ALLOC(); + *val = ZSTR_EMPTY_ALLOC(); return SUCCESS; } @@ -515,7 +515,7 @@ PS_READ_FUNC(files) php_error_docref(NULL, E_WARNING, "read returned less bytes than requested"); } zend_string_release(*val); - *val = STR_EMPTY_ALLOC(); + *val = ZSTR_EMPTY_ALLOC(); return FAILURE; } diff --git a/ext/session/session.c b/ext/session/session.c index 819008c5bb..c3d9fbf1d6 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -565,7 +565,7 @@ static void php_session_save_current_state(int write) /* {{{ */ } zend_string_release(val); } else { - ret = PS(mod)->s_write(&PS(mod_data), PS(id), STR_EMPTY_ALLOC(), PS(gc_maxlifetime)); + ret = PS(mod)->s_write(&PS(mod_data), PS(id), ZSTR_EMPTY_ALLOC(), PS(gc_maxlifetime)); } } diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 003ad4cee7..76fcfdaaab 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -969,7 +969,7 @@ static inline zend_string *sxe_xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr li res = zend_string_init((char*)tmp, strlen((char *)tmp), 0); xmlFree(tmp); } else { - res = STR_EMPTY_ALLOC(); + res = ZSTR_EMPTY_ALLOC(); } return res; diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 70ae050594..58147f3d39 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -278,7 +278,7 @@ static zval *spl_array_get_dimension_ptr(int check_inherited, zval *object, zval switch (Z_TYPE_P(offset)) { case IS_NULL: - offset_key = STR_EMPTY_ALLOC(); + offset_key = ZSTR_EMPTY_ALLOC(); goto fetch_dim_string; case IS_STRING: offset_key = Z_STR_P(offset); diff --git a/ext/standard/array.c b/ext/standard/array.c index 5341544b39..e923968840 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -5051,7 +5051,7 @@ PHP_FUNCTION(array_key_exists) } RETURN_FALSE; case IS_NULL: - if (zend_hash_exists(array, STR_EMPTY_ALLOC())) { + if (zend_hash_exists(array, ZSTR_EMPTY_ALLOC())) { RETURN_TRUE; } RETURN_FALSE; diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index c04307f1c9..110da9210c 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -174,7 +174,7 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb (Z_STRLEN_P(arg2) == 4 && !strncasecmp(Z_STRVAL_P(arg2), "none", sizeof("none") - 1)) || (Z_STRLEN_P(arg2) == 5 && !strncasecmp(Z_STRVAL_P(arg2), "false", sizeof("false") - 1)) ) { - // TODO: USE STR_EMPTY_ALLOC()? + // TODO: USE ZSTR_EMPTY_ALLOC()? ZVAL_NEW_STR(&new_property, zend_string_init("", sizeof("")-1, persistent)); } else { /* Other than true/false setting */ ZVAL_STR(&new_property, zend_string_dup(Z_STR_P(arg2), persistent)); diff --git a/ext/standard/file.c b/ext/standard/file.c index 1755dab81b..53e22d533e 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1115,7 +1115,7 @@ PHPAPI PHP_FUNCTION(fgetss) if (allowed != NULL) { // TODO: reimplement to avoid reallocation ??? - if (IS_INTERNED(allowed)) { + if (ZSTR_IS_INTERNED(allowed)) { allowed_tags = estrndup(allowed->val, allowed->len); allowed_tags_len = allowed->len; } else { @@ -1127,7 +1127,7 @@ PHPAPI PHP_FUNCTION(fgetss) retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); // TODO: reimplement to avoid reallocation ??? - if (allowed && IS_INTERNED(allowed)) { + if (allowed && ZSTR_IS_INTERNED(allowed)) { efree(allowed_tags); } diff --git a/ext/standard/html.c b/ext/standard/html.c index 2677e3ec51..b6a799d4a4 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1303,7 +1303,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle continue; } else { zend_string_free(replaced); - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } } else { /* SUCCESS */ mbsequence = &old[cursor_before]; diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 0343e403e7..6662384be5 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -454,7 +454,7 @@ finish: user_headers = estrndup(tmp->val, tmp->len); - if (IS_INTERNED(tmp)) { + if (ZSTR_IS_INTERNED(tmp)) { tmp = zend_string_init(tmp->val, tmp->len, 0); } else if (GC_REFCOUNT(tmp) > 1) { GC_REFCOUNT(tmp)--; diff --git a/ext/standard/math.c b/ext/standard/math.c index 1ae74f8049..8d041d55df 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -1081,7 +1081,7 @@ PHPAPI zend_string * _php_math_longtobase(zval *arg, int base) zend_ulong value; if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) { - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } value = Z_LVAL_P(arg); @@ -1108,7 +1108,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base) static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) { - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } if (Z_TYPE_P(arg) == IS_DOUBLE) { @@ -1119,7 +1119,7 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base) /* Don't try to convert +/- infinity */ if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) { php_error_docref(NULL, E_WARNING, "Number too large"); - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } end = ptr = buf + sizeof(buf) - 1; diff --git a/ext/standard/string.c b/ext/standard/string.c index 1ce301e9cc..31d4e9f14d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1302,7 +1302,7 @@ PHP_FUNCTION(implode) return; } - delim = STR_EMPTY_ALLOC(); + delim = ZSTR_EMPTY_ALLOC(); arr = arg1; } else { if (Z_TYPE_P(arg1) == IS_ARRAY) { @@ -2131,12 +2131,12 @@ PHP_FUNCTION(strripos) RETURN_FALSE; } - STR_ALLOCA_ALLOC(ord_needle, 1, use_heap); + ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap); if (Z_TYPE_P(zneedle) == IS_STRING) { needle = Z_STR_P(zneedle); } else { if (php_needle_char(zneedle, ord_needle->val) != SUCCESS) { - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } ord_needle->val[1] = '\0'; @@ -2144,7 +2144,7 @@ PHP_FUNCTION(strripos) } if ((haystack->len == 0) || (needle->len == 0)) { - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -2153,7 +2153,7 @@ PHP_FUNCTION(strripos) Can also avoid tolower emallocs */ if (offset >= 0) { if ((size_t)offset > haystack->len) { - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2162,7 +2162,7 @@ PHP_FUNCTION(strripos) } else { p = haystack->val; if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) { - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2172,12 +2172,12 @@ PHP_FUNCTION(strripos) *ord_needle->val = tolower(*needle->val); while (e >= p) { if (tolower(*e) == *ord_needle->val) { - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; } - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } @@ -2185,7 +2185,7 @@ PHP_FUNCTION(strripos) if (offset >= 0) { if ((size_t)offset > haystack->len) { zend_string_release(haystack_dup); - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2194,7 +2194,7 @@ PHP_FUNCTION(strripos) } else { if (offset < -INT_MAX || (size_t)(-offset) > haystack->len) { zend_string_release(haystack_dup); - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string"); RETURN_FALSE; } @@ -2211,11 +2211,11 @@ PHP_FUNCTION(strripos) RETVAL_LONG(found - haystack_dup->val); zend_string_release(needle_dup); zend_string_release(haystack_dup); - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); } else { zend_string_release(needle_dup); zend_string_release(haystack_dup); - STR_ALLOCA_FREE(ord_needle, use_heap); + ZSTR_ALLOCA_FREE(ord_needle, use_heap); RETURN_FALSE; } } @@ -3855,7 +3855,7 @@ PHPAPI zend_string *php_addslashes(zend_string *str, int should_free) zend_string *new_str; if (!str) { - return STR_EMPTY_ALLOC(); + return ZSTR_EMPTY_ALLOC(); } source = str->val; @@ -4710,7 +4710,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, int *stateptr, char *all rp = rbuf; br = 0; if (allow) { -//??? if (IS_INTERNED(allow)) { +//??? if (ZSTR_IS_INTERNED(allow)) { //??? allow_free = allow = zend_str_tolower_dup(allow, allow_len); //??? } else { allow_free = NULL; diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index 5149fb376b..f3b22c1e27 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.7.5 */ +/* Generated by re2c 0.13.5 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -245,10 +245,10 @@ static inline int unserialize_allowed_class(zend_string *class_name, HashTable * return 0; } - STR_ALLOCA_ALLOC(lcname, class_name->len, use_heap); + ZSTR_ALLOCA_ALLOC(lcname, class_name->len, use_heap); zend_str_tolower_copy(lcname->val, class_name->val, class_name->len); res = zend_hash_exists(classes, lcname); - STR_ALLOCA_FREE(lcname, use_heap); + ZSTR_ALLOCA_FREE(lcname, use_heap); return res; } @@ -661,8 +661,7 @@ yy20: if (yybm[0+yych] & 128) { goto yy20; } - if (yych <= '/') goto yy18; - if (yych >= ';') goto yy18; + if (yych != ':') goto yy18; yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; @@ -811,7 +810,7 @@ yy20: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 815 "ext/standard/var_unserializer.c" +#line 814 "ext/standard/var_unserializer.c" yy25: yych = *++YYCURSOR; if (yych <= ',') { @@ -844,7 +843,7 @@ yy27: return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 848 "ext/standard/var_unserializer.c" +#line 847 "ext/standard/var_unserializer.c" yy32: yych = *++YYCURSOR; if (yych == '+') goto yy33; @@ -886,7 +885,7 @@ yy34: return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 890 "ext/standard/var_unserializer.c" +#line 889 "ext/standard/var_unserializer.c" yy39: yych = *++YYCURSOR; if (yych == '+') goto yy40; @@ -935,7 +934,7 @@ yy41: ZVAL_STR(rval, str); return 1; } -#line 939 "ext/standard/var_unserializer.c" +#line 938 "ext/standard/var_unserializer.c" yy46: yych = *++YYCURSOR; if (yych == '+') goto yy47; @@ -983,7 +982,7 @@ yy48: ZVAL_STRINGL(rval, str, len); return 1; } -#line 987 "ext/standard/var_unserializer.c" +#line 986 "ext/standard/var_unserializer.c" yy53: yych = *++YYCURSOR; if (yych <= '/') { @@ -1080,7 +1079,7 @@ use_double: ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1084 "ext/standard/var_unserializer.c" +#line 1083 "ext/standard/var_unserializer.c" yy65: yych = *++YYCURSOR; if (yych <= ',') { @@ -1155,7 +1154,7 @@ yy73: return 1; } -#line 1159 "ext/standard/var_unserializer.c" +#line 1158 "ext/standard/var_unserializer.c" yy76: yych = *++YYCURSOR; if (yych == 'N') goto yy73; @@ -1208,7 +1207,7 @@ yy79: ZVAL_LONG(rval, parse_iv(start + 2)); return 1; } -#line 1212 "ext/standard/var_unserializer.c" +#line 1211 "ext/standard/var_unserializer.c" yy83: yych = *++YYCURSOR; if (yych <= '/') goto yy18; @@ -1222,7 +1221,7 @@ yy83: ZVAL_BOOL(rval, parse_iv(start + 2)); return 1; } -#line 1226 "ext/standard/var_unserializer.c" +#line 1225 "ext/standard/var_unserializer.c" yy87: ++YYCURSOR; #line 577 "ext/standard/var_unserializer.re" @@ -1231,7 +1230,7 @@ yy87: ZVAL_NULL(rval); return 1; } -#line 1235 "ext/standard/var_unserializer.c" +#line 1234 "ext/standard/var_unserializer.c" yy89: yych = *++YYCURSOR; if (yych <= ',') { @@ -1277,7 +1276,7 @@ yy91: return 1; } -#line 1281 "ext/standard/var_unserializer.c" +#line 1280 "ext/standard/var_unserializer.c" yy95: yych = *++YYCURSOR; if (yych <= ',') { @@ -1322,7 +1321,7 @@ yy97: return 1; } -#line 1326 "ext/standard/var_unserializer.c" +#line 1325 "ext/standard/var_unserializer.c" } #line 877 "ext/standard/var_unserializer.re" diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index cfb116a447..fbe9cf9cf3 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -243,10 +243,10 @@ static inline int unserialize_allowed_class(zend_string *class_name, HashTable * return 0; } - STR_ALLOCA_ALLOC(lcname, class_name->len, use_heap); + ZSTR_ALLOCA_ALLOC(lcname, class_name->len, use_heap); zend_str_tolower_copy(lcname->val, class_name->val, class_name->len); res = zend_hash_exists(classes, lcname); - STR_ALLOCA_FREE(lcname, use_heap); + ZSTR_ALLOCA_FREE(lcname, use_heap); return res; } diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 5df732ff53..e1c13e6515 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -646,7 +646,7 @@ static zend_string *php_tidy_file_to_mem(char *filename, zend_bool use_include_p return NULL; } if ((data = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) == NULL) { - data = STR_EMPTY_ALLOC(); + data = ZSTR_EMPTY_ALLOC(); } php_stream_close(stream); @@ -928,7 +928,7 @@ static void *php_tidy_get_opt_val(PHPTidyDoc *ptdoc, TidyOption opt, TidyOptionT if (val) { return (void *) zend_string_init(val, strlen(val), 0); } else { - return (void *) STR_EMPTY_ALLOC(); + return (void *) ZSTR_EMPTY_ALLOC(); } } break; diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 19e4369aef..4e55c715e1 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -720,13 +720,13 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X ent.type = ST_STRING; SET_STACK_VARNAME; - ZVAL_STR(&ent.data, STR_EMPTY_ALLOC()); + ZVAL_STR(&ent.data, ZSTR_EMPTY_ALLOC()); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp((char *)name, EL_BINARY)) { ent.type = ST_BINARY; SET_STACK_VARNAME; - ZVAL_STR(&ent.data, STR_EMPTY_ALLOC()); + ZVAL_STR(&ent.data, ZSTR_EMPTY_ALLOC()); wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp((char *)name, EL_CHAR)) { int i; |
