]> granicus.if.org Git - php/commitdiff
Move constants into read-only data segment
authorDmitry Stogov <dmitry@zend.com>
Thu, 14 Dec 2017 22:55:00 +0000 (01:55 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 14 Dec 2017 22:55:00 +0000 (01:55 +0300)
ext/mbstring/mbstring.c
ext/mysqli/mysqli.c
ext/mysqlnd/mysqlnd_reverse_api.c
ext/mysqlnd/mysqlnd_reverse_api.h
ext/pdo_mysql/pdo_mysql.c
ext/phar/phar_object.c
ext/spl/spl_directory.h

index 086920846b6a43fdc971fa24ff2c47a1c0521c1c..ae7305d5db675754e6767d95dd716b6bb19df5bf 100644 (file)
@@ -666,7 +666,7 @@ static void _php_mb_allocators_pfree(void *ptr)
        pefree(ptr, 1);
 }
 
-static mbfl_allocators _php_mb_allocators = {
+static const mbfl_allocators _php_mb_allocators = {
        _php_mb_allocators_malloc,
        _php_mb_allocators_realloc,
        _php_mb_allocators_calloc,
@@ -1562,7 +1562,7 @@ PHP_MINIT_FUNCTION(mbstring)
 #if defined(COMPILE_DL_MBSTRING) && defined(ZTS)
 ZEND_TSRMLS_CACHE_UPDATE();
 #endif
-       __mbfl_allocators = &_php_mb_allocators;
+       __mbfl_allocators = (mbfl_allocators*)&_php_mb_allocators;
 
        REGISTER_INI_ENTRIES();
 
index 97660f002297a1e972275e9a63d606a904b0e073..59f324c36efaef22b00f6b27c7e6c9f35c3eec4c 100644 (file)
@@ -498,7 +498,7 @@ static MYSQLND *mysqli_convert_zv_to_mysqlnd(zval * zv)
        return NULL;
 }
 
-static MYSQLND_REVERSE_API mysqli_reverse_api = {
+static const MYSQLND_REVERSE_API mysqli_reverse_api = {
        &mysqli_module_entry,
        mysqli_convert_zv_to_mysqlnd
 };
index 120faa2dd8e11ea5b2c591905f62d74e2039d959..1c693e10e665ba87f0944a5fb6250d1af6022c25 100644 (file)
@@ -57,9 +57,9 @@ mysqlnd_reverse_api_get_api_list(void)
 
 /* {{{ mysqlnd_reverse_api_register_api */
 PHPAPI void
-mysqlnd_reverse_api_register_api(MYSQLND_REVERSE_API * apiext)
+mysqlnd_reverse_api_register_api(const MYSQLND_REVERSE_API * apiext)
 {
-       zend_hash_str_add_ptr(&mysqlnd_api_ext_ht, apiext->module->name, strlen(apiext->module->name), apiext);
+       zend_hash_str_add_ptr(&mysqlnd_api_ext_ht, apiext->module->name, strlen(apiext->module->name), (void*)apiext);
 }
 /* }}} */
 
index b5aec01e04396d27431d7b89d411da6782dcfd23..afe5a805770de229175c38e6c1f6838ba4af9405 100644 (file)
@@ -32,7 +32,7 @@ PHPAPI void mysqlnd_reverse_api_end(void);
 
 PHPAPI HashTable * mysqlnd_reverse_api_get_api_list(void);
 
-PHPAPI void mysqlnd_reverse_api_register_api(MYSQLND_REVERSE_API * apiext);
+PHPAPI void mysqlnd_reverse_api_register_api(const MYSQLND_REVERSE_API * apiext);
 PHPAPI MYSQLND * zval_to_mysqlnd(zval * zv, const unsigned int client_api_capabilities, unsigned int * save_client_api_capabilities);
 
 #endif /* MYSQLND_REVERSE_API_H */
index d7e5e809e7e4551524145af100b199d5085fe46a..9d1059487b79d386b0fb21601af4486084f6b781 100644 (file)
@@ -82,7 +82,7 @@ static MYSQLND * pdo_mysql_convert_zv_to_mysqlnd(zval * zv)
        return NULL;
 }
 
-static MYSQLND_REVERSE_API pdo_mysql_reverse_api = {
+static const MYSQLND_REVERSE_API pdo_mysql_reverse_api = {
        &pdo_mysql_module_entry,
        pdo_mysql_convert_zv_to_mysqlnd
 };
index 9a8504aa731bdacbe4b4ae93fd75a15c901f2521..625ed3c6c797a8583d0e5db92ffa3ade2b90b57c 100644 (file)
@@ -1129,7 +1129,7 @@ static void phar_spl_foreign_clone(spl_filesystem_object *src, spl_filesystem_ob
 }
 /* }}} */
 
-static spl_other_handler phar_spl_foreign_handler = {
+static const spl_other_handler phar_spl_foreign_handler = {
        phar_spl_foreign_dtor,
        phar_spl_foreign_clone
 };
index edb81e75a3c97b13b0967e585dba421a76fd421b..c9214109b2dcc7fb19d4e65edc49983c2498445e 100644 (file)
@@ -61,7 +61,7 @@ typedef struct {
 
 struct _spl_filesystem_object {
        void               *oth;
-       spl_other_handler  *oth_handler;
+       const spl_other_handler  *oth_handler;
        char               *_path;
        size_t             _path_len;
        char               *orig_path;