mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Convert some macros to zend_always_inline functions (#8288)
This doesn't have an effect really, but humans and IDEs can struggle to see through the macro soup when they first interact with PHP's source code. Moreover, this reduces some of the macro expansion hell when they appear in compiler warnings.
This commit is contained in:
committed by
GitHub
parent
55f8c14224
commit
faa83f2f34
@@ -298,8 +298,9 @@ ZEND_API zend_string *zend_print_zval_r_to_str(zval *expr, int indent);
|
||||
ZEND_API void zend_print_flat_zval_r(zval *expr);
|
||||
void zend_print_flat_zval_r_to_buf(smart_str *str, zval *expr);
|
||||
|
||||
#define zend_print_variable(var) \
|
||||
zend_print_zval((var), 0)
|
||||
static zend_always_inline size_t zend_print_variable(zval *var) {
|
||||
return zend_print_zval(var, 0);
|
||||
}
|
||||
|
||||
ZEND_API ZEND_COLD void zend_output_debug_string(bool trigger_break, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ static zend_module_entry **module_post_deactivate_handlers;
|
||||
|
||||
static zend_class_entry **class_cleanup_handlers;
|
||||
|
||||
ZEND_API zend_result _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */
|
||||
ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array) /* {{{ */
|
||||
{
|
||||
zval *param_ptr;
|
||||
uint32_t arg_count;
|
||||
|
||||
108
Zend/zend_API.h
108
Zend/zend_API.h
@@ -329,15 +329,13 @@ typedef struct _zend_fcall_info_cache {
|
||||
ZEND_API int zend_next_free_module(void);
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API zend_result _zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array);
|
||||
ZEND_API zend_result zend_get_parameters_array_ex(uint32_t param_count, zval *argument_array);
|
||||
|
||||
/* internal function to efficiently copy parameters when executing __call() */
|
||||
ZEND_API zend_result zend_copy_parameters_array(uint32_t param_count, zval *argument_array);
|
||||
|
||||
#define zend_get_parameters_array(ht, param_count, argument_array) \
|
||||
_zend_get_parameters_array_ex(param_count, argument_array)
|
||||
#define zend_get_parameters_array_ex(param_count, argument_array) \
|
||||
_zend_get_parameters_array_ex(param_count, argument_array)
|
||||
zend_get_parameters_array_ex(param_count, argument_array)
|
||||
#define zend_parse_parameters_none() \
|
||||
(EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : (zend_wrong_parameters_none_error(), FAILURE))
|
||||
#define zend_parse_parameters_none_throw() \
|
||||
@@ -382,8 +380,9 @@ ZEND_API void zend_class_implements(zend_class_entry *class_entry, int num_inter
|
||||
|
||||
ZEND_API zend_result zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, bool persistent);
|
||||
|
||||
#define zend_register_class_alias(name, ce) \
|
||||
zend_register_class_alias_ex(name, sizeof(name)-1, ce, 1)
|
||||
static zend_always_inline zend_result zend_register_class_alias(const char *name, zend_class_entry *ce) {
|
||||
return zend_register_class_alias_ex(name, strlen(name), ce, 1);
|
||||
}
|
||||
#define zend_register_ns_class_alias(ns, name, ce) \
|
||||
zend_register_class_alias_ex(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, ce, 1)
|
||||
|
||||
@@ -540,18 +539,42 @@ ZEND_API void add_assoc_object_ex(zval *arg, const char *key, size_t key_len, ze
|
||||
ZEND_API void add_assoc_reference_ex(zval *arg, const char *key, size_t key_len, zend_reference *ref);
|
||||
ZEND_API void add_assoc_zval_ex(zval *arg, const char *key, size_t key_len, zval *value);
|
||||
|
||||
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key), __n)
|
||||
#define add_assoc_null(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key))
|
||||
#define add_assoc_bool(__arg, __key, __b) add_assoc_bool_ex(__arg, __key, strlen(__key), __b)
|
||||
#define add_assoc_resource(__arg, __key, __r) add_assoc_resource_ex(__arg, __key, strlen(__key), __r)
|
||||
#define add_assoc_double(__arg, __key, __d) add_assoc_double_ex(__arg, __key, strlen(__key), __d)
|
||||
#define add_assoc_str(__arg, __key, __str) add_assoc_str_ex(__arg, __key, strlen(__key), __str)
|
||||
#define add_assoc_string(__arg, __key, __str) add_assoc_string_ex(__arg, __key, strlen(__key), __str)
|
||||
#define add_assoc_stringl(__arg, __key, __str, __length) add_assoc_stringl_ex(__arg, __key, strlen(__key), __str, __length)
|
||||
#define add_assoc_array(__arg, __key, __arr) add_assoc_array_ex(__arg, __key, strlen(__key), __arr)
|
||||
#define add_assoc_object(__arg, __key, __obj) add_assoc_object_ex(__arg, __key, strlen(__key), __obj)
|
||||
#define add_assoc_reference(__arg, __key, __ref) add_assoc_object_ex(__arg, __key, strlen(__key), __ref)
|
||||
#define add_assoc_zval(__arg, __key, __value) add_assoc_zval_ex(__arg, __key, strlen(__key), __value)
|
||||
static zend_always_inline void add_assoc_long(zval *arg, const char *key, zend_long n) {
|
||||
add_assoc_long_ex(arg, key, strlen(key), n);
|
||||
}
|
||||
static zend_always_inline void add_assoc_null(zval *arg, const char *key) {
|
||||
add_assoc_null_ex(arg, key, strlen(key));
|
||||
}
|
||||
static zend_always_inline void add_assoc_bool(zval *arg, const char *key, bool b) {
|
||||
add_assoc_bool_ex(arg, key, strlen(key), b);
|
||||
}
|
||||
static zend_always_inline void add_assoc_resource(zval *arg, const char *key, zend_resource *r) {
|
||||
add_assoc_resource_ex(arg, key, strlen(key), r);
|
||||
}
|
||||
static zend_always_inline void add_assoc_double(zval *arg, const char *key, double d) {
|
||||
add_assoc_double_ex(arg, key, strlen(key), d);
|
||||
}
|
||||
static zend_always_inline void add_assoc_str(zval *arg, const char *key, zend_string *str) {
|
||||
add_assoc_str_ex(arg, key, strlen(key), str);
|
||||
}
|
||||
static zend_always_inline void add_assoc_string(zval *arg, const char *key, const char *str) {
|
||||
add_assoc_string_ex(arg, key, strlen(key), str);
|
||||
}
|
||||
static zend_always_inline void add_assoc_stringl(zval *arg, const char *key, const char *str, size_t length) {
|
||||
add_assoc_stringl_ex(arg, key, strlen(key), str, length);
|
||||
}
|
||||
static zend_always_inline void add_assoc_array(zval *arg, const char *key, zend_array *arr) {
|
||||
add_assoc_array_ex(arg, key, strlen(key), arr);
|
||||
}
|
||||
static zend_always_inline void add_assoc_object(zval *arg, const char *key, zend_object *obj) {
|
||||
add_assoc_object_ex(arg, key, strlen(key), obj);
|
||||
}
|
||||
static zend_always_inline void add_assoc_reference(zval *arg, const char *key, zend_reference *ref) {
|
||||
add_assoc_reference_ex(arg, key, strlen(key), ref);
|
||||
}
|
||||
static zend_always_inline void add_assoc_zval(zval *arg, const char *key, zval *value) {
|
||||
add_assoc_zval_ex(arg, key, strlen(key), value);
|
||||
}
|
||||
|
||||
ZEND_API void add_index_long(zval *arg, zend_ulong index, zend_long n);
|
||||
ZEND_API void add_index_null(zval *arg, zend_ulong index);
|
||||
@@ -602,19 +625,42 @@ ZEND_API void add_property_object_ex(zval *arg, const char *key, size_t key_len,
|
||||
ZEND_API void add_property_reference_ex(zval *arg, const char *key, size_t key_len, zend_reference *ref);
|
||||
ZEND_API void add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value);
|
||||
|
||||
#define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key), __n)
|
||||
#define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key))
|
||||
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b)
|
||||
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r)
|
||||
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d)
|
||||
#define add_property_str(__arg, __key, __str) add_property_str_ex(__arg, __key, strlen(__key), __str)
|
||||
#define add_property_string(__arg, __key, __str) add_property_string_ex(__arg, __key, strlen(__key), __str)
|
||||
#define add_property_stringl(__arg, __key, __str, __length) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length)
|
||||
#define add_property_array(__arg, __key, __arr) add_property_array_ex(__arg, __key, strlen(__key), __arr)
|
||||
#define add_property_object(__arg, __key, __obj) add_property_object_ex(__arg, __key, strlen(__key), __obj)
|
||||
#define add_property_reference(__arg, __key, __ref) add_property_reference_ex(__arg, __key, strlen(__key), __ref)
|
||||
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value)
|
||||
|
||||
static zend_always_inline void add_property_long(zval *arg, const char *key, zend_long n) {
|
||||
add_property_long_ex(arg, key, strlen(key), n);
|
||||
}
|
||||
static zend_always_inline void add_property_null(zval *arg, const char *key) {
|
||||
add_property_null_ex(arg, key, strlen(key));
|
||||
}
|
||||
static zend_always_inline void add_property_bool(zval *arg, const char *key, bool b) {
|
||||
add_property_bool_ex(arg, key, strlen(key), b);
|
||||
}
|
||||
static zend_always_inline void add_property_resource(zval *arg, const char *key, zend_resource *r) {
|
||||
add_property_resource_ex(arg, key, strlen(key), r);
|
||||
}
|
||||
static zend_always_inline void add_property_double(zval *arg, const char *key, double d) {
|
||||
add_property_double_ex(arg, key, strlen(key), d);
|
||||
}
|
||||
static zend_always_inline void add_property_str(zval *arg, const char *key, zend_string *str) {
|
||||
add_property_str_ex(arg, key, strlen(key), str);
|
||||
}
|
||||
static zend_always_inline void add_property_string(zval *arg, const char *key, const char *str) {
|
||||
add_property_string_ex(arg, key, strlen(key), str);
|
||||
}
|
||||
static zend_always_inline void add_property_stringl(zval *arg, const char *key, const char *str, size_t length) {
|
||||
add_property_stringl_ex(arg, key, strlen(key), str, length);
|
||||
}
|
||||
static zend_always_inline void add_property_array(zval *arg, const char *key, zend_array *arr) {
|
||||
add_property_array_ex(arg, key, strlen(key), arr);
|
||||
}
|
||||
static zend_always_inline void add_property_object(zval *arg, const char *key, zend_object *obj) {
|
||||
add_property_object_ex(arg, key, strlen(key), obj);
|
||||
}
|
||||
static zend_always_inline void add_property_reference(zval *arg, const char *key, zend_reference *ref) {
|
||||
add_property_reference_ex(arg, key, strlen(key), ref);
|
||||
}
|
||||
static zend_always_inline void add_property_zval(zval *arg, const char *key, zval *value) {
|
||||
add_property_zval_ex(arg, key, strlen(key), value);
|
||||
}
|
||||
|
||||
ZEND_API zend_result _call_user_function_impl(zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[], HashTable *named_params);
|
||||
|
||||
|
||||
@@ -2716,7 +2716,7 @@ ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, Ha
|
||||
|
||||
|
||||
/* This function should be made binary safe */
|
||||
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos)
|
||||
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, const HashPosition *pos)
|
||||
{
|
||||
uint32_t idx;
|
||||
Bucket *p;
|
||||
@@ -2740,7 +2740,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zen
|
||||
return HASH_KEY_NON_EXISTENT;
|
||||
}
|
||||
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos)
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, const HashPosition *pos)
|
||||
{
|
||||
uint32_t idx;
|
||||
Bucket *p;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define ZEND_HASH_H
|
||||
|
||||
#include "zend.h"
|
||||
#include "zend_sort.h"
|
||||
|
||||
#define HASH_KEY_IS_STRING 1
|
||||
#define HASH_KEY_IS_LONG 2
|
||||
@@ -244,35 +245,45 @@ static zend_always_inline bool zend_hash_index_exists(const HashTable *ht, zend_
|
||||
/* traversing */
|
||||
ZEND_API HashPosition ZEND_FASTCALL zend_hash_get_current_pos(const HashTable *ht);
|
||||
|
||||
#define zend_hash_has_more_elements_ex(ht, pos) \
|
||||
(zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS)
|
||||
ZEND_API zend_result ZEND_FASTCALL zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API zend_result ZEND_FASTCALL zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos);
|
||||
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, const HashPosition *pos);
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, const HashPosition *pos);
|
||||
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
|
||||
|
||||
#define zend_hash_has_more_elements(ht) \
|
||||
zend_hash_has_more_elements_ex(ht, &(ht)->nInternalPointer)
|
||||
#define zend_hash_move_forward(ht) \
|
||||
zend_hash_move_forward_ex(ht, &(ht)->nInternalPointer)
|
||||
#define zend_hash_move_backwards(ht) \
|
||||
zend_hash_move_backwards_ex(ht, &(ht)->nInternalPointer)
|
||||
#define zend_hash_get_current_key(ht, str_index, num_index) \
|
||||
zend_hash_get_current_key_ex(ht, str_index, num_index, &(ht)->nInternalPointer)
|
||||
#define zend_hash_get_current_key_zval(ht, key) \
|
||||
zend_hash_get_current_key_zval_ex(ht, key, &(ht)->nInternalPointer)
|
||||
#define zend_hash_get_current_key_type(ht) \
|
||||
zend_hash_get_current_key_type_ex(ht, &(ht)->nInternalPointer)
|
||||
#define zend_hash_get_current_data(ht) \
|
||||
zend_hash_get_current_data_ex(ht, &(ht)->nInternalPointer)
|
||||
#define zend_hash_internal_pointer_reset(ht) \
|
||||
zend_hash_internal_pointer_reset_ex(ht, &(ht)->nInternalPointer)
|
||||
#define zend_hash_internal_pointer_end(ht) \
|
||||
zend_hash_internal_pointer_end_ex(ht, &(ht)->nInternalPointer)
|
||||
static zend_always_inline zend_result zend_hash_has_more_elements_ex(HashTable *ht, HashPosition *pos) {
|
||||
return (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTENT ? FAILURE : SUCCESS);
|
||||
}
|
||||
static zend_always_inline zend_result zend_hash_has_more_elements(HashTable *ht) {
|
||||
return zend_hash_has_more_elements_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline zend_result zend_hash_move_forward(HashTable *ht) {
|
||||
return zend_hash_move_forward_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline zend_result zend_hash_move_backwards(HashTable *ht) {
|
||||
return zend_hash_move_backwards_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline int zend_hash_get_current_key(const HashTable *ht, zend_string **str_index, zend_ulong *num_index) {
|
||||
return zend_hash_get_current_key_ex(ht, str_index, num_index, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline void zend_hash_get_current_key_zval(const HashTable *ht, zval *key) {
|
||||
zend_hash_get_current_key_zval_ex(ht, key, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline int zend_hash_get_current_key_type(HashTable *ht) {
|
||||
return zend_hash_get_current_key_type_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline zval* zend_hash_get_current_data(HashTable *ht) {
|
||||
return zend_hash_get_current_data_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline void zend_hash_internal_pointer_reset(HashTable *ht) {
|
||||
zend_hash_internal_pointer_reset_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
static zend_always_inline void zend_hash_internal_pointer_end(HashTable *ht) {
|
||||
zend_hash_internal_pointer_end_ex(ht, &ht->nInternalPointer);
|
||||
}
|
||||
|
||||
/* Copying, merging and sorting */
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor);
|
||||
@@ -287,14 +298,17 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, bucket_compare_func_t compare_func, bool renumber);
|
||||
ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag);
|
||||
|
||||
#define zend_hash_sort(ht, compare_func, renumber) \
|
||||
zend_hash_sort_ex(ht, zend_sort, compare_func, renumber)
|
||||
static zend_always_inline void ZEND_FASTCALL zend_hash_sort(HashTable *ht, bucket_compare_func_t compare_func, zend_bool renumber) {
|
||||
zend_hash_sort_ex(ht, zend_sort, compare_func, renumber);
|
||||
}
|
||||
|
||||
#define zend_hash_num_elements(ht) \
|
||||
(ht)->nNumOfElements
|
||||
static zend_always_inline uint32_t zend_hash_num_elements(const HashTable *ht) {
|
||||
return ht->nNumOfElements;
|
||||
}
|
||||
|
||||
#define zend_hash_next_free_element(ht) \
|
||||
(ht)->nNextFreeElement
|
||||
static zend_always_inline zend_long zend_hash_next_free_element(const HashTable *ht) {
|
||||
return ht->nNextFreeElement;
|
||||
}
|
||||
|
||||
ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht);
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@ BEGIN_EXTERN_C()
|
||||
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
|
||||
ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *parent_ce, bool checked);
|
||||
|
||||
#define zend_do_inheritance(ce, parent_ce) \
|
||||
zend_do_inheritance_ex(ce, parent_ce, 0)
|
||||
static zend_always_inline void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce) {
|
||||
zend_do_inheritance_ex(ce, parent_ce, 0);
|
||||
}
|
||||
|
||||
ZEND_API zend_class_entry *zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name, zend_string *key);
|
||||
|
||||
|
||||
@@ -40,14 +40,23 @@ typedef struct _zend_user_iterator {
|
||||
|
||||
ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, uint32_t param_count, zval* arg1, zval* arg2);
|
||||
|
||||
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
|
||||
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL)
|
||||
static zend_always_inline zval* zend_call_method_with_0_params(zend_object *object, zend_class_entry *obj_ce,
|
||||
zend_function **fn_proxy, const char *function_name, zval *retval)
|
||||
{
|
||||
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
#define zend_call_method_with_1_params(obj, obj_ce, fn_proxy, function_name, retval, arg1) \
|
||||
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 1, arg1, NULL)
|
||||
static zend_always_inline zval* zend_call_method_with_1_params(zend_object *object, zend_class_entry *obj_ce,
|
||||
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1)
|
||||
{
|
||||
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 1, arg1, NULL);
|
||||
}
|
||||
|
||||
#define zend_call_method_with_2_params(obj, obj_ce, fn_proxy, function_name, retval, arg1, arg2) \
|
||||
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 2, arg1, arg2)
|
||||
static zend_always_inline zval* zend_call_method_with_2_params(zend_object *object, zend_class_entry *obj_ce,
|
||||
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1, zval* arg2)
|
||||
{
|
||||
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 2, arg1, arg2);
|
||||
}
|
||||
|
||||
ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter);
|
||||
ZEND_API zend_result zend_user_it_valid(zend_object_iterator *_iter);
|
||||
|
||||
@@ -66,10 +66,25 @@ ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos);
|
||||
ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos);
|
||||
ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos);
|
||||
|
||||
#define zend_llist_get_first(l) zend_llist_get_first_ex(l, NULL)
|
||||
#define zend_llist_get_last(l) zend_llist_get_last_ex(l, NULL)
|
||||
#define zend_llist_get_next(l) zend_llist_get_next_ex(l, NULL)
|
||||
#define zend_llist_get_prev(l) zend_llist_get_prev_ex(l, NULL)
|
||||
static zend_always_inline void *zend_llist_get_first(zend_llist *l)
|
||||
{
|
||||
return zend_llist_get_first_ex(l, NULL);
|
||||
}
|
||||
|
||||
static zend_always_inline void *zend_llist_get_last(zend_llist *l)
|
||||
{
|
||||
return zend_llist_get_last_ex(l, NULL);
|
||||
}
|
||||
|
||||
static zend_always_inline void *zend_llist_get_next(zend_llist *l)
|
||||
{
|
||||
return zend_llist_get_next_ex(l, NULL);
|
||||
}
|
||||
|
||||
static zend_always_inline void *zend_llist_get_prev(zend_llist *l)
|
||||
{
|
||||
return zend_llist_get_prev_ex(l, NULL);
|
||||
}
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
|
||||
@@ -450,8 +450,12 @@ ZEND_API char* ZEND_FASTCALL zend_str_toupper_dup_ex(const char *source,
|
||||
ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower_ex(zend_string *str, bool persistent);
|
||||
ZEND_API zend_string* ZEND_FASTCALL zend_string_toupper_ex(zend_string *str, bool persistent);
|
||||
|
||||
#define zend_string_tolower(str) zend_string_tolower_ex(str, 0)
|
||||
#define zend_string_toupper(str) zend_string_toupper_ex(str, 0)
|
||||
static zend_always_inline zend_string* zend_string_tolower(zend_string *str) {
|
||||
return zend_string_tolower_ex(str, false);
|
||||
}
|
||||
static zend_always_inline zend_string* zend_string_toupper(zend_string *str) {
|
||||
return zend_string_toupper_ex(str, false);
|
||||
}
|
||||
|
||||
ZEND_API int ZEND_FASTCALL zend_binary_zval_strcmp(zval *s1, zval *s2);
|
||||
ZEND_API int ZEND_FASTCALL zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
|
||||
|
||||
@@ -21,33 +21,6 @@
|
||||
#include "zend_globals.h"
|
||||
#include "zend_smart_str_public.h"
|
||||
|
||||
#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_extract(dest) \
|
||||
smart_str_extract_ex((dest), 0)
|
||||
#define smart_str_trim_to_size(dest) \
|
||||
smart_str_trim_to_size_ex((dest), 0)
|
||||
#define smart_str_extend(dest, len) \
|
||||
smart_str_extend_ex((dest), (len), 0)
|
||||
#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_append_smart_str(dest, src) \
|
||||
smart_str_append_smart_str_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)
|
||||
#define smart_str_free(dest) \
|
||||
smart_str_free_ex((dest), 0)
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len);
|
||||
@@ -87,6 +60,11 @@ static zend_always_inline char* smart_str_extend_ex(smart_str *dest, size_t len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static zend_always_inline char* smart_str_extend(smart_str *dest, size_t length)
|
||||
{
|
||||
return smart_str_extend_ex(dest, length, false);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_free_ex(smart_str *str, bool persistent) {
|
||||
if (str->s) {
|
||||
zend_string_release_ex(str->s, persistent);
|
||||
@@ -95,6 +73,11 @@ static zend_always_inline void smart_str_free_ex(smart_str *str, bool persistent
|
||||
str->a = 0;
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_free(smart_str *str)
|
||||
{
|
||||
smart_str_free_ex(str, false);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_0(smart_str *str) {
|
||||
if (str->s) {
|
||||
ZSTR_VAL(str->s)[ZSTR_LEN(str->s)] = '\0';
|
||||
@@ -113,6 +96,11 @@ static zend_always_inline void smart_str_trim_to_size_ex(smart_str *str, bool pe
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_trim_to_size(smart_str *dest)
|
||||
{
|
||||
smart_str_trim_to_size_ex(dest, false);
|
||||
}
|
||||
|
||||
static zend_always_inline zend_string *smart_str_extract_ex(smart_str *str, bool persistent) {
|
||||
if (str->s) {
|
||||
zend_string *res;
|
||||
@@ -126,6 +114,11 @@ static zend_always_inline zend_string *smart_str_extract_ex(smart_str *str, bool
|
||||
}
|
||||
}
|
||||
|
||||
static zend_always_inline zend_string *smart_str_extract(smart_str *dest)
|
||||
{
|
||||
return smart_str_extract_ex(dest, false);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_appendc_ex(smart_str *dest, char ch, bool persistent) {
|
||||
size_t new_len = smart_str_alloc(dest, 1, persistent);
|
||||
ZSTR_VAL(dest->s)[new_len - 1] = ch;
|
||||
@@ -154,15 +147,54 @@ static zend_always_inline void smart_str_append_long_ex(smart_str *dest, zend_lo
|
||||
smart_str_appendl_ex(dest, result, buf + sizeof(buf) - 1 - result, persistent);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_append_long(smart_str *dest, zend_long num)
|
||||
{
|
||||
smart_str_append_long_ex(dest, num, false);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_append_unsigned_ex(smart_str *dest, zend_ulong num, 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_append_unsigned(smart_str *dest, zend_ulong num)
|
||||
{
|
||||
smart_str_append_unsigned_ex(dest, num, false);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_appendl(smart_str *dest, const char *src, size_t length)
|
||||
{
|
||||
smart_str_appendl_ex(dest, src, length, false);
|
||||
}
|
||||
static zend_always_inline void smart_str_appends_ex(smart_str *dest, const char *src, bool persistent)
|
||||
{
|
||||
smart_str_appendl_ex(dest, src, strlen(src), persistent);
|
||||
}
|
||||
static zend_always_inline void smart_str_appends(smart_str *dest, const char *src)
|
||||
{
|
||||
smart_str_appendl_ex(dest, src, strlen(src), false);
|
||||
}
|
||||
static zend_always_inline void smart_str_append(smart_str *dest, const zend_string *src)
|
||||
{
|
||||
smart_str_append_ex(dest, src, false);
|
||||
}
|
||||
static zend_always_inline void smart_str_appendc(smart_str *dest, char ch)
|
||||
{
|
||||
smart_str_appendc_ex(dest, ch, false);
|
||||
}
|
||||
static zend_always_inline void smart_str_append_smart_str(smart_str *dest, const smart_str *src)
|
||||
{
|
||||
smart_str_append_smart_str_ex(dest, src, false);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static zend_always_inline void smart_str_sets(smart_str *dest, const char *src)
|
||||
{
|
||||
smart_str_setl(dest, src, strlen(src));
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user