diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-09-27 18:00:48 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-09-27 18:00:48 +0000 |
commit | 6c810b0d4c1b12c675f69f5cfb32f26b6179d460 (patch) | |
tree | e95f336ce39693101bed812985b914c9bd80523e /Zend/zend_API.c | |
parent | f6d9901873156c560eb6da7dafbefc56c363b2bd (diff) | |
download | php-git-6c810b0d4c1b12c675f69f5cfb32f26b6179d460.tar.gz |
Improved memory usage by movig constants to read only memory. (Dmitry, Pierre)
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 1d9f9b2917..87118406b3 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -965,14 +965,14 @@ ZEND_API int _object_init(zval *arg ZEND_FILE_LINE_DC TSRMLS_DC) } -ZEND_API int add_assoc_function(zval *arg, char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) +ZEND_API int add_assoc_function(zval *arg, const char *key, void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) { zend_error(E_WARNING, "add_assoc_function() is no longer supported"); return FAILURE; } -ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n) +ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n) { zval *tmp; @@ -982,7 +982,7 @@ ZEND_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } -ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len) +ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len) { zval *tmp; @@ -992,7 +992,7 @@ ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } -ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b) +ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b) { zval *tmp; @@ -1002,7 +1002,7 @@ ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b) return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } -ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r) +ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r) { zval *tmp; @@ -1013,7 +1013,7 @@ ZEND_API int add_assoc_resource_ex(zval *arg, char *key, uint key_len, int r) } -ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d) +ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d) { zval *tmp; @@ -1024,7 +1024,7 @@ ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d) } -ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate) +ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate) { zval *tmp; @@ -1035,7 +1035,7 @@ ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, } -ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate) +ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate) { zval *tmp; @@ -1045,7 +1045,7 @@ ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } -ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value) +ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value) { return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL); } @@ -1105,7 +1105,7 @@ ZEND_API int add_index_double(zval *arg, ulong index, double d) } -ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate) +ZEND_API int add_index_string(zval *arg, ulong index, const char *str, int duplicate) { zval *tmp; @@ -1116,7 +1116,7 @@ ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate) } -ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, int duplicate) +ZEND_API int add_index_stringl(zval *arg, ulong index, const char *str, uint length, int duplicate) { zval *tmp; @@ -1188,7 +1188,7 @@ ZEND_API int add_next_index_double(zval *arg, double d) } -ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate) +ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate) { zval *tmp; @@ -1199,7 +1199,7 @@ ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate) } -ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate) +ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate) { zval *tmp; @@ -1216,7 +1216,7 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value) } -ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, void **dest, int duplicate) +ZEND_API int add_get_assoc_string_ex(zval *arg, const char *key, uint key_len, const char *str, void **dest, int duplicate) { zval *tmp; @@ -1227,7 +1227,7 @@ ZEND_API int add_get_assoc_string_ex(zval *arg, char *key, uint key_len, char *s } -ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, void **dest, int duplicate) +ZEND_API int add_get_assoc_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length, void **dest, int duplicate) { zval *tmp; @@ -1260,7 +1260,7 @@ ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest) } -ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest, int duplicate) +ZEND_API int add_get_index_string(zval *arg, ulong index, const char *str, void **dest, int duplicate) { zval *tmp; @@ -1271,7 +1271,7 @@ ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest } -ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint length, void **dest, int duplicate) +ZEND_API int add_get_index_stringl(zval *arg, ulong index, const char *str, uint length, void **dest, int duplicate) { zval *tmp; @@ -1427,7 +1427,7 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC) /* Check module dependencies */ if (module->deps) { - zend_module_dep *dep = module->deps; + const zend_module_dep *dep = module->deps; while (dep->name) { if (dep->type == MODULE_DEP_REQUIRED) { @@ -1485,7 +1485,7 @@ static void zend_sort_modules(void *base, size_t count, size_t siz, compare_func try_again: m = (zend_module_entry*)(*b1)->pData; if (!m->module_started && m->deps) { - zend_module_dep *dep = m->deps; + const zend_module_dep *dep = m->deps; while (dep->name) { if (dep->type == MODULE_DEP_REQUIRED || dep->type == MODULE_DEP_OPTIONAL) { b2 = b1 + 1; @@ -1530,7 +1530,7 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TS /* Check module dependencies */ if (module->deps) { - zend_module_dep *dep = module->deps; + const zend_module_dep *dep = module->deps; while (dep->name) { if (dep->type == MODULE_DEP_CONFLICTS) { @@ -1627,9 +1627,9 @@ ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_ } /* registers all functions in *library_functions in the function hash */ -ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC) +ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC) { - zend_function_entry *ptr = functions; + const zend_function_entry *ptr = functions; zend_function function, *reg_function; zend_internal_function *internal_function = (zend_internal_function *)&function; int count=0, unload=0; @@ -1660,11 +1660,11 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr while (ptr->fname) { internal_function->handler = ptr->handler; - internal_function->function_name = ptr->fname; + internal_function->function_name = (char*)ptr->fname; internal_function->scope = scope; internal_function->prototype = NULL; if (ptr->arg_info) { - internal_function->arg_info = ptr->arg_info+1; + internal_function->arg_info = (zend_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ if (ptr->arg_info[0].required_num_args == -1) { @@ -1857,9 +1857,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr /* count=-1 means erase all functions, otherwise, * erase the first count functions */ -ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC) +ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC) { - zend_function_entry *ptr = functions; + const zend_function_entry *ptr = functions; int i=0; HashTable *target_function_table = function_table; @@ -2112,7 +2112,7 @@ static zend_object_value display_disabled_class(zend_class_entry *class_type TSR return retval; } -static zend_function_entry disabled_class_new[] = { +static const zend_function_entry disabled_class_new[] = { { NULL, NULL, NULL } }; @@ -2486,7 +2486,7 @@ ZEND_API int zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_cache *f } -ZEND_API char *zend_get_module_version(char *module_name) +ZEND_API const char *zend_get_module_version(const char *module_name) { char *lname; int name_len = strlen(module_name); |