diff options
author | Nikita Popov <nikic@php.net> | 2014-09-20 22:42:02 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-09-21 20:49:39 +0200 |
commit | e33f3d3b7c9a69fe069484045a27d282aa98b00e (patch) | |
tree | 90e1513cf7384f8b80c5278601ba3ed1d20c9636 /ext | |
parent | e1fe5cb8c2ba47581c079d2b91e2fede29181dfe (diff) | |
download | php-git-e33f3d3b7c9a69fe069484045a27d282aa98b00e.tar.gz |
Move smart_str implementation into Zend/
So we can use it there as well...
For now I've retained the zend_smart_str_public.h header, though
it would probably be better to just move that one struct into
zend_types.h.
Diffstat (limited to 'ext')
54 files changed, 53 insertions, 208 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 5c517d71a5..d7cacf54f9 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -82,7 +82,7 @@ #define SMART_STR_PREALLOC 4096 -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/standard/info.h" #include "ext/standard/file.h" #include "ext/standard/url.h" diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h index cc96a410f3..665682c23a 100644 --- a/ext/curl/php_curl.h +++ b/ext/curl/php_curl.h @@ -23,7 +23,7 @@ #define _PHP_CURL_H #include "php.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str_public.h" #ifdef COMPILE_DL_CURL #undef HAVE_CURL diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 3fd4b27eb3..360c6d3f67 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -999,7 +999,7 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D) /* {{{ date() and gmdate() data */ -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" static char *mon_full_names[] = { "January", "February", "March", "April", diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 5ca29ed276..de4ea4c464 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -519,7 +519,7 @@ PHP_MSHUTDOWN_FUNCTION(dba) } /* }}} */ -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* {{{ PHP_MINFO_FUNCTION */ diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c index 8ddd55b95a..083b5382b6 100644 --- a/ext/filter/sanitizing_filters.c +++ b/ext/filter/sanitizing_filters.c @@ -20,7 +20,7 @@ #include "php_filter.h" #include "filter_private.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* {{{ STRUCTS */ typedef unsigned long filter_map[256]; diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 5a51c50ea6..18e7965199 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -25,7 +25,7 @@ #include "php_gmp.h" #include "ext/standard/info.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str_public.h" +#include "zend_smart_str_public.h" #include "zend_exceptions.h" #if HAVE_GMP diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 7ca97f9418..d425f6cf1e 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -55,7 +55,7 @@ #undef iconv #endif -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/standard/base64.h" #include "ext/standard/quot_print.h" diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index d937681507..8dc56c5223 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -40,7 +40,7 @@ #include "ext/standard/php_string.h" #include "ext/standard/info.h" #include "ext/standard/file.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/pcre/php_pcre.h" #ifdef ERROR diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h index 6a809e8e39..7e8f0cf5e4 100644 --- a/ext/intl/intl_error.h +++ b/ext/intl/intl_error.h @@ -21,7 +21,7 @@ #include <unicode/utypes.h> #include <unicode/parseerr.h> -#include <ext/standard/php_smart_str.h> +#include <zend_smart_str_public.h> #define INTL_ERROR_CODE(e) (e).code diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 2679983646..27f917ffbb 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -36,7 +36,7 @@ #include <zend.h> #include <php.h> #include "main/php_ini.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" ZEND_EXTERN_MODULE_GLOBALS( intl ) diff --git a/ext/intl/transliterator/transliterator.h b/ext/intl/transliterator/transliterator.h index 3e38095b89..041c6df41b 100644 --- a/ext/intl/transliterator/transliterator.h +++ b/ext/intl/transliterator/transliterator.h @@ -21,7 +21,7 @@ #include <unicode/utypes.h> #include <unicode/utrans.h> -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str_public.h" void transliterator_register_constants( INIT_FUNC_ARGS ); smart_str transliterator_parse_error_to_string( UParseError* pe ); diff --git a/ext/json/JSON_parser.h b/ext/json/JSON_parser.h index 3df999c5f3..da47f4078f 100644 --- a/ext/json/JSON_parser.h +++ b/ext/json/JSON_parser.h @@ -4,8 +4,8 @@ #define JSON_PARSER_H #include "php.h" -#include "ext/standard/php_smart_str.h" #include "php_json.h" +#include "zend_smart_str.h" #define JSON_PARSER_DEFAULT_DEPTH 512 diff --git a/ext/json/json.c b/ext/json/json.c index 485d14d11b..16e452a004 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -26,7 +26,7 @@ #include "php_ini.h" #include "ext/standard/info.h" #include "ext/standard/html.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "JSON_parser.h" #include "php_json.h" #include <zend_exceptions.h> diff --git a/ext/json/php_json.h b/ext/json/php_json.h index 05dcc43e06..5b2dc127dd 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -22,7 +22,7 @@ #define PHP_JSON_H #define PHP_JSON_VERSION "1.2.1" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str_public.h" extern zend_module_entry json_module_entry; #define phpext_json_ptr &json_module_entry diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h index b06462db28..9518654b5b 100644 --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h @@ -34,7 +34,7 @@ extern zend_module_entry libxml_module_entry; # define PHP_LIBXML_API #endif -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str_public.h" #include <libxml/tree.h> #define LIBXML_SAVE_NOEMPTYTAG 1<<2 diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 246f2223d1..de0bc768ad 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -28,7 +28,7 @@ #if HAVE_MBREGEX -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/standard/info.h" #include "php_mbregex.h" #include "mbstring.h" diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index e572b7e4ba..82cbe72176 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -40,7 +40,7 @@ #include "php_globals.h" #include "ext/standard/info.h" #include "ext/standard/php_rand.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "php_mcrypt_filter.h" static int le_mcrypt; @@ -452,7 +452,7 @@ static PHP_MSHUTDOWN_FUNCTION(mcrypt) /* {{{ */ } /* }}} */ -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" PHP_MINFO_FUNCTION(mcrypt) /* {{{ */ { diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index eea6348034..4eff098999 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -30,7 +30,7 @@ #include "php_ini.h" #include "php_globals.h" #include "ext/standard/info.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "php_mysqli_structs.h" #include "mysqli_priv.h" diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index e137e822d8..db0d0ee677 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -29,7 +29,7 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "php_mysqli_structs.h" #include "mysqli_priv.h" diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 513df95a80..41f34e366a 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -27,7 +27,7 @@ #include "mysqlnd_statistics.h" #include "mysqlnd_charset.h" #include "mysqlnd_debug.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* TODO : diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index f37738dd12..daa758c043 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -539,7 +539,7 @@ void _mysqlnd_free(void *ptr MYSQLND_MEM_D) #define SMART_STR_START_SIZE 2048 #define SMART_STR_PREALLOC 512 -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* {{{ _mysqlnd_pestrndup */ diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index 406c5a69b1..6be8b68034 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -23,7 +23,7 @@ #ifndef MYSQLND_STRUCTS_H #define MYSQLND_STRUCTS_H -#include "ext/standard/php_smart_str_public.h" +#include "zend_smart_str_public.h" #define MYSQLND_TYPEDEFED_METHODS diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c index c38975f146..a16018f6ba 100644 --- a/ext/mysqlnd/php_mysqlnd.c +++ b/ext/mysqlnd/php_mysqlnd.c @@ -27,7 +27,7 @@ #include "mysqlnd_statistics.h" #include "mysqlnd_reverse_api.h" #include "ext/standard/info.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* {{{ mysqlnd_functions[] * diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index c941c8eaf2..dba13ced93 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -33,7 +33,7 @@ #include "php.h" #include "ext/standard/info.h" #include "php_ini.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #if HAVE_OCI8 diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 28afe1d4dd..b3213f9aea 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -28,7 +28,7 @@ #include "ext/standard/file.h" #include "ext/standard/url.h" #include "streams/php_streams_int.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "php_openssl.h" #include "php_network.h" #include <openssl/ssl.h> diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 3b49bf9ef5..67857da2c7 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -23,7 +23,7 @@ #include "php_globals.h" #include "php_pcre.h" #include "ext/standard/info.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #if HAVE_PCRE || HAVE_BUNDLED_PCRE diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 8ea4d3c06f..207764b165 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -35,7 +35,7 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/php_standard.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/ereg/php_regex.h" #ifdef PHP_WIN32 # include "win32/time.h" diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index 77df0a71c2..f49143bc8c 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -35,6 +35,7 @@ #include "zend_operators.h" #include "zend_qsort.h" #include "zend_vm.h" +#include "zend_smart_str.h" #include "main/php_streams.h" #include "main/streams/php_stream_plain_wrapper.h" #include "main/SAPI.h" @@ -49,7 +50,6 @@ #include "ext/standard/md5.h" #include "ext/standard/sha1.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str.h" #include "ext/standard/php_versioning.h" #ifndef PHP_WIN32 #include "TSRM/tsrm_strtok_r.h" diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index 23841e4eea..ff0671ce9f 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -42,7 +42,7 @@ #include "php_main.h" #include "fopen_wrappers.h" #include "ext/standard/php_standard.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #ifdef __riscos__ #include <unixlib/local.h> diff --git a/ext/readline/readline_cli.h b/ext/readline/readline_cli.h index 0531c71e35..6e57c83408 100644 --- a/ext/readline/readline_cli.h +++ b/ext/readline/readline_cli.h @@ -20,7 +20,7 @@ /* $Id$ */ #include "php.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str_public.h" ZEND_BEGIN_MODULE_GLOBALS(cli_readline) char *pager; diff --git a/ext/session/session.c b/ext/session/session.c index 18c02822e3..63bb00e06a 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -48,7 +48,7 @@ #include "ext/standard/url_scanner_ex.h" #include "ext/standard/php_rand.h" /* for RAND_MAX */ #include "ext/standard/info.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/standard/url.h" #include "ext/standard/basic_functions.h" #include "ext/standard/head.h" diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h index 1cba5e7f07..6d36792981 100644 --- a/ext/soap/php_soap.h +++ b/ext/soap/php_soap.h @@ -29,7 +29,7 @@ #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) #include "ext/session/php_session.h" #endif -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "php_ini.h" #include "SAPI.h" #include <libxml/parser.h> diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index f31208cf4d..d808271728 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -6,7 +6,7 @@ #endif #include <Zend/zend_llist.h> -#include <ext/standard/php_smart_str.h> +#include <zend_smart_str.h> #ifndef PHP_WIN32 # include <sys/types.h> diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 11293eb5e5..211180a08d 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -26,7 +26,7 @@ #include "php_ini.h" #include "ext/standard/info.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "zend_interfaces.h" #include "zend_exceptions.h" diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index a02cfb685d..0a6f97c563 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -29,7 +29,7 @@ #include "php_spl.h" #include "ext/standard/info.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "spl_functions.h" #include "spl_engine.h" #include "spl_iterators.h" diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 75f229dfc1..dddc8c5e73 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -35,7 +35,7 @@ #include "spl_directory.h" #include "spl_array.h" #include "spl_exceptions.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #ifdef accept #undef accept diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 289e9212e8..d3ce72aaa3 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -28,7 +28,7 @@ #include "ext/standard/info.h" #include "ext/standard/php_array.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "zend_interfaces.h" #include "zend_exceptions.h" diff --git a/ext/standard/array.c b/ext/standard/array.c index de5639fbab..c8e79957b5 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -45,7 +45,7 @@ #include "basic_functions.h" #include "php_string.h" #include "php_rand.h" -#include "php_smart_str.h" +#include "zend_smart_str.h" #ifdef HAVE_SPL #include "ext/spl/spl_array.h" #endif diff --git a/ext/standard/file.c b/ext/standard/file.c index 66b0f0f5ff..506105b7ae 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -35,7 +35,7 @@ #include "php_open_temporary_file.h" #include "ext/standard/basic_functions.h" #include "php_ini.h" -#include "php_smart_str.h" +#include "zend_smart_str.h" #include <stdio.h> #include <stdlib.h> diff --git a/ext/standard/filters.c b/ext/standard/filters.c index e76ddfb619..bef239920b 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -27,7 +27,7 @@ #include "ext/standard/basic_functions.h" #include "ext/standard/file.h" #include "ext/standard/php_string.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* {{{ rot13 stream filter implementation */ static char rot13_from[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 83e894c123..d695926995 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -27,7 +27,7 @@ #include "php_network.h" #include "php_ini.h" #include "ext/standard/basic_functions.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include <stdio.h> #include <stdlib.h> diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h index 0351b2a59c..0979348314 100644 --- a/ext/standard/php_http.h +++ b/ext/standard/php_http.h @@ -22,7 +22,7 @@ #define PHP_HTTP_H #include "php.h" -#include "php_smart_str.h" +#include "zend_smart_str.h" PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr, const char *num_prefix, int num_prefix_len, diff --git a/ext/standard/php_smart_str.h b/ext/standard/php_smart_str.h deleted file mode 100644 index e32def2307..0000000000 --- a/ext/standard/php_smart_str.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2014 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sascha Schumann <sascha@schumann.cx> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef PHP_SMART_STR_H -#define PHP_SMART_STR_H - -#include "php_smart_str_public.h" - -#include <stdlib.h> -#include <zend.h> - -#ifndef SMART_STR_PREALLOC -#define SMART_STR_PREALLOC 128 -#endif - -#ifndef SMART_STR_START_SIZE -#define SMART_STR_START_SIZE 78 -#endif - -/* wrapper */ - -#define smart_str_appends_ex(dest, src, what) \ - smart_str_appendl_ex((dest), (src), strlen(src), (what)) -#define smart_str_appends(dest, src) \ - smart_str_appendl((dest), (src), strlen(src)) -#define smart_str_appendc(dest, c) \ - smart_str_appendc_ex((dest), (c), 0) -#define smart_str_appendl(dest, src, len) \ - smart_str_appendl_ex((dest), (src), (len), 0) -#define smart_str_append(dest, src) \ - smart_str_append_ex((dest), (src), 0) -#define smart_str_sets(dest, src) \ - smart_str_setl((dest), (src), strlen(src)); -#define smart_str_append_long(dest, val) \ - smart_str_append_long_ex((dest), (val), 0) -#define smart_str_append_unsigned(dest, val) \ - smart_str_append_unsigned_ex((dest), (val), 0) - -static zend_always_inline size_t smart_str_alloc(smart_str *str, size_t len, zend_bool persistent) { - size_t newlen; - if (!str->s) { - newlen = len; - str->a = newlen < SMART_STR_START_SIZE - ? SMART_STR_START_SIZE - : newlen + SMART_STR_PREALLOC; - str->s = zend_string_alloc(str->a, persistent); - str->s->len = 0; - } else { - newlen = str->s->len + len; - if (newlen >= str->a) { - str->a = newlen + SMART_STR_PREALLOC; - str->s = (zend_string *) perealloc(str->s, _STR_HEADER_SIZE + str->a + 1, persistent); - } - } - return newlen; -} - -static zend_always_inline void smart_str_free(smart_str *str) { - if (str->s) { - zend_string_release(str->s); - str->s = NULL; - } - str->a = 0; -} - -static zend_always_inline void smart_str_0(smart_str *str) { - if (str->s) { - str->s->val[str->s->len] = '\0'; - } -} - -static zend_always_inline void smart_str_appendc_ex(smart_str *dest, char ch, zend_bool persistent) { - size_t new_len = smart_str_alloc(dest, 1, persistent); - dest->s->val[new_len - 1] = ch; - dest->s->len = new_len; -} - -static zend_always_inline void smart_str_appendl_ex(smart_str *dest, const char *str, size_t len, zend_bool persistent) { - size_t new_len = smart_str_alloc(dest, len, persistent); - memcpy(dest->s->val + dest->s->len, str, len); - dest->s->len = new_len; -} - -static zend_always_inline void smart_str_append_ex(smart_str *dest, const smart_str *src, zend_bool persistent) { - if (src->s && src->s->len) { - smart_str_appendl_ex(dest, src->s->val, src->s->len, persistent); - } -} - -static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_long num, zend_bool persistent) { - char buf[32]; - char *result = zend_print_long_to_buf(buf + sizeof(buf) - 1, num); - smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent); -} - -static zend_always_inline void smart_str_append_unsigned_ex(smart_str *dest, zend_ulong num, zend_bool persistent) { - char buf[32]; - char *result = zend_print_ulong_to_buf(buf + sizeof(buf) - 1, num); - smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent); -} - -static zend_always_inline void smart_str_setl(smart_str *dest, const char *src, size_t len) { - smart_str_free(dest); - smart_str_appendl(dest, src, len); -} - -#endif diff --git a/ext/standard/php_smart_str_public.h b/ext/standard/php_smart_str_public.h deleted file mode 100644 index e33348efd6..0000000000 --- a/ext/standard/php_smart_str_public.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2014 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Sascha Schumann <sascha@schumann.cx> | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef PHP_SMART_STR_PUBLIC_H -#define PHP_SMART_STR_PUBLIC_H - -#include <sys/types.h> - -typedef struct { - zend_string *s; - size_t a; -} smart_str; - -#endif diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index 5a9aae1a24..90979159ab 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -22,7 +22,7 @@ #define PHP_VAR_H #include "ext/standard/basic_functions.h" -#include "ext/standard/php_smart_str_public.h" +#include "zend_smart_str_public.h" PHP_FUNCTION(var_dump); PHP_FUNCTION(var_export); diff --git a/ext/standard/string.c b/ext/standard/string.c index 559fb8b57f..b49192b1b7 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -56,7 +56,7 @@ #include "zend_execute.h" #include "php_globals.h" #include "basic_functions.h" -#include "php_smart_str.h" +#include "zend_smart_str.h" #include <Zend/zend_exceptions.h> #ifdef ZTS #include "TSRM.h" diff --git a/ext/standard/url_scanner_ex.c b/ext/standard/url_scanner_ex.c index b7c9403f8b..71658ec271 100644 --- a/ext/standard/url_scanner_ex.c +++ b/ext/standard/url_scanner_ex.c @@ -42,7 +42,7 @@ #define url_scanner url_scanner_ex -#include "php_smart_str.h" +#include "zend_smart_str.h" static void tag_dtor(zval *zv) { diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h index 00dd9fbfb0..3c5b68c95b 100644 --- a/ext/standard/url_scanner_ex.h +++ b/ext/standard/url_scanner_ex.h @@ -31,7 +31,7 @@ PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, co PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC); PHPAPI int php_url_scanner_reset_vars(TSRMLS_D); -#include "php_smart_str_public.h" +#include "zend_smart_str_public.h" typedef struct { /* Used by the mainloop of the scanner */ diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 28a5ca3196..ce7acfad6b 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -40,7 +40,7 @@ #define url_scanner url_scanner_ex -#include "php_smart_str.h" +#include "zend_smart_str.h" static void tag_dtor(zval *zv) { diff --git a/ext/standard/var.c b/ext/standard/var.c index 532e53a110..88a8f9ebe0 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -28,7 +28,7 @@ #include "php.h" #include "php_string.h" #include "php_var.h" -#include "php_smart_str.h" +#include "zend_smart_str.h" #include "basic_functions.h" #include "php_incomplete_class.h" diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c index 15021783a6..d158366ea5 100644 --- a/ext/sysvmsg/sysvmsg.c +++ b/ext/sysvmsg/sysvmsg.c @@ -27,7 +27,7 @@ #include "ext/standard/info.h" #include "php_sysvmsg.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" /* In order to detect MSG_EXCEPT use at run time; we have no way * of knowing what the bit definitions are, so we can't just define diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index e0f9df3ac3..c87be09e4f 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -36,7 +36,7 @@ #include "php_sysvshm.h" #include "ext/standard/php_var.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "php_ini.h" /* {{{ arginfo */ diff --git a/ext/wddx/php_wddx_api.h b/ext/wddx/php_wddx_api.h index 420377eb22..5c47109ee3 100644 --- a/ext/wddx/php_wddx_api.h +++ b/ext/wddx/php_wddx_api.h @@ -21,7 +21,7 @@ #ifndef PHP_WDDX_API_H #define PHP_WDDX_API_H -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str_public.h" #define WDDX_ARRAY_S "<array length='%d'>" #define WDDX_ARRAY_E "</array>" diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index be5913d521..705babd885 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -35,7 +35,7 @@ #include "ext/standard/php_incomplete_class.h" #include "ext/standard/base64.h" #include "ext/standard/info.h" -#include "ext/standard/php_smart_str.h" +#include "zend_smart_str.h" #include "ext/standard/html.h" #include "ext/standard/php_string.h" #include "ext/date/php_date.h" |