Skip to content

Commit 95f81e8

Browse files
committed
Convert macros to inline function in Zend Interfaces
1 parent d891e46 commit 95f81e8

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

Zend/zend_interfaces.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, z
8484
}
8585
/* }}} */
8686

87+
extern ZEND_API inline zval* zend_call_method_with_0_params(zend_object *object, zend_class_entry *obj_ce,
88+
zend_function **fn_proxy, const char *function_name, zval *retval);
89+
extern ZEND_API inline zval* zend_call_method_with_1_params(zend_object *object, zend_class_entry *obj_ce,
90+
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1);
91+
extern ZEND_API inline zval* zend_call_method_with_2_params(zend_object *object, zend_class_entry *obj_ce,
92+
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1, zval* arg2);
93+
8794
/* iterator interface, c-level functions used by engine */
8895

8996
/* {{{ zend_user_it_new_iterator */

Zend/zend_interfaces.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,21 @@ typedef struct _zend_user_iterator {
4040

4141
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);
4242

43-
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
44-
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL)
45-
46-
#define zend_call_method_with_1_params(obj, obj_ce, fn_proxy, function_name, retval, arg1) \
47-
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 1, arg1, NULL)
48-
49-
#define zend_call_method_with_2_params(obj, obj_ce, fn_proxy, function_name, retval, arg1, arg2) \
50-
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 2, arg1, arg2)
43+
ZEND_API inline zval* zend_call_method_with_0_params(zend_object *object, zend_class_entry *obj_ce,
44+
zend_function **fn_proxy, const char *function_name, zval *retval)
45+
{
46+
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 0, NULL, NULL);
47+
}
48+
ZEND_API inline zval* zend_call_method_with_1_params(zend_object *object, zend_class_entry *obj_ce,
49+
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1)
50+
{
51+
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 1, arg1, NULL);
52+
}
53+
ZEND_API inline zval* zend_call_method_with_2_params(zend_object *object, zend_class_entry *obj_ce,
54+
zend_function **fn_proxy, const char *function_name, zval *retval, zval* arg1, zval* arg2)
55+
{
56+
return zend_call_method(object, obj_ce, fn_proxy, function_name, strlen(function_name), retval, 2, arg1, arg2);
57+
}
5158

5259
#define REGISTER_MAGIC_INTERFACE(class_name, class_name_str) \
5360
{\

0 commit comments

Comments
 (0)