summaryrefslogtreecommitdiff
path: root/Zend/zend_API.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-09-27 18:00:48 +0000
committerDmitry Stogov <dmitry@php.net>2007-09-27 18:00:48 +0000
commit6c810b0d4c1b12c675f69f5cfb32f26b6179d460 (patch)
treee95f336ce39693101bed812985b914c9bd80523e /Zend/zend_API.h
parentf6d9901873156c560eb6da7dafbefc56c363b2bd (diff)
downloadphp-git-6c810b0d4c1b12c675f69f5cfb32f26b6179d460.tar.gz
Improved memory usage by movig constants to read only memory. (Dmitry, Pierre)
Diffstat (limited to 'Zend/zend_API.h')
-rw-r--r--Zend/zend_API.h54
1 files changed, 27 insertions, 27 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 861abc8a7d..b4b27c41b4 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -33,9 +33,9 @@
BEGIN_EXTERN_C()
typedef struct _zend_function_entry {
- char *fname;
+ const char *fname;
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- struct _zend_arg_info *arg_info;
+ const struct _zend_arg_info *arg_info;
zend_uint num_args;
zend_uint flags;
} zend_function_entry;
@@ -68,7 +68,7 @@ typedef struct _zend_function_entry {
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 },
#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, 1, allow_null, pass_by_ref, 0, 0 },
#define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \
- zend_arg_info name[] = { \
+ const zend_arg_info name[] = { \
{ NULL, 0, NULL, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args },
#define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \
ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1)
@@ -194,8 +194,8 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC,
/* End of parameter parsing API -- andrei */
-ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
-ZEND_API void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table 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_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
ZEND_API int zend_startup_module(zend_module_entry *module_entry);
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
@@ -222,7 +222,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
-ZEND_API char *zend_get_module_version(char *module_name);
+ZEND_API const char *zend_get_module_version(const char *module_name);
ZEND_API int zend_get_module_started(char *module_name);
ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC);
@@ -291,16 +291,16 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *ce, HashTa
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destroy_ht TSRMLS_DC);
/* no longer supported */
-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_API int add_assoc_long_ex(zval *arg, char *key, uint key_len, long n);
-ZEND_API int add_assoc_null_ex(zval *arg, char *key, uint key_len);
-ZEND_API int add_assoc_bool_ex(zval *arg, char *key, uint key_len, int b);
-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_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate);
-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_zval_ex(zval *arg, char *key, uint key_len, zval *value);
+ZEND_API int add_assoc_long_ex(zval *arg, const char *key, uint key_len, long n);
+ZEND_API int add_assoc_null_ex(zval *arg, const char *key, uint key_len);
+ZEND_API int add_assoc_bool_ex(zval *arg, const char *key, uint key_len, int b);
+ZEND_API int add_assoc_resource_ex(zval *arg, const char *key, uint key_len, int r);
+ZEND_API int add_assoc_double_ex(zval *arg, const char *key, uint key_len, double d);
+ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
+ZEND_API int add_assoc_stringl_ex(zval *arg, const char *key, uint key_len, char *str, uint length, int duplicate);
+ZEND_API int add_assoc_zval_ex(zval *arg, const char *key, uint key_len, zval *value);
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1)
@@ -322,8 +322,8 @@ ZEND_API int add_index_null(zval *arg, ulong idx);
ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
-ZEND_API int add_index_string(zval *arg, ulong idx, char *str, int duplicate);
-ZEND_API int add_index_stringl(zval *arg, ulong idx, char *str, uint length, int duplicate);
+ZEND_API int add_index_string(zval *arg, ulong idx, const char *str, int duplicate);
+ZEND_API int add_index_stringl(zval *arg, ulong idx, const char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
ZEND_API int add_next_index_long(zval *arg, long n);
@@ -331,20 +331,20 @@ ZEND_API int add_next_index_null(zval *arg);
ZEND_API int add_next_index_bool(zval *arg, int b);
ZEND_API int add_next_index_resource(zval *arg, int r);
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_stringl(zval *arg, char *str, uint length, int duplicate);
+ZEND_API int add_next_index_string(zval *arg, const char *str, int duplicate);
+ZEND_API int add_next_index_stringl(zval *arg, const char *str, uint length, int duplicate);
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_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, 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);
+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);
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
-ZEND_API int add_get_index_string(zval *arg, ulong idx, char *str, void **dest, int duplicate);
-ZEND_API int add_get_index_stringl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate);
+ZEND_API int add_get_index_string(zval *arg, ulong idx, const char *str, void **dest, int duplicate);
+ZEND_API int add_get_index_stringl(zval *arg, ulong idx, const char *str, uint length, void **dest, int duplicate);
ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
@@ -462,16 +462,16 @@ END_EXTERN_C()
}
#define ZVAL_STRING(z, s, duplicate) { \
- char *__s=(s); \
+ const char *__s=(s); \
(z)->value.str.len = strlen(__s); \
- (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \
+ (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):(char*)__s); \
(z)->type = IS_STRING; \
}
#define ZVAL_STRINGL(z, s, l, duplicate) { \
- char *__s=(s); int __l=l; \
+ const char *__s=(s); int __l=l;\
(z)->value.str.len = __l; \
- (z)->value.str.val = (duplicate?estrndup(__s, __l):__s); \
+ (z)->value.str.val = (duplicate?estrndup(__s, __l):(char*)__s); \
(z)->type = IS_STRING; \
}