|
21 | 21 | #include "php_spl.h"
|
22 | 22 | #include "zend_interfaces.h"
|
23 | 23 |
|
24 |
| -PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object); |
25 |
| - |
26 | 24 | PHPAPI zend_long spl_offset_convert_to_long(zval *offset);
|
27 | 25 |
|
28 |
| -/* {{{ spl_instantiate_arg_ex1 */ |
29 |
| -static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1) |
| 26 | +static inline void spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, zval *arg1) |
30 | 27 | {
|
31 |
| - zend_function *func = pce->constructor; |
32 |
| - spl_instantiate(pce, retval); |
33 |
| - |
34 |
| - zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL); |
35 |
| - return 0; |
| 28 | + object_init_ex(retval, pce); |
| 29 | + zend_call_known_instance_method_with_1_params(pce->constructor, Z_OBJ_P(retval), NULL, arg1); |
36 | 30 | }
|
37 |
| -/* }}} */ |
38 | 31 |
|
39 |
| -/* {{{ spl_instantiate_arg_ex2 */ |
40 |
| -static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, zval *arg1, zval *arg2) |
| 32 | +static inline void spl_instantiate_arg_ex2( |
| 33 | + zend_class_entry *pce, zval *retval, zval *arg1, zval *arg2) |
41 | 34 | {
|
42 |
| - zend_function *func = pce->constructor; |
43 |
| - spl_instantiate(pce, retval); |
44 |
| - |
45 |
| - zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2); |
46 |
| - return 0; |
| 35 | + object_init_ex(retval, pce); |
| 36 | + zend_call_known_instance_method_with_2_params( |
| 37 | + pce->constructor, Z_OBJ_P(retval), NULL, arg1, arg2); |
47 | 38 | }
|
48 |
| -/* }}} */ |
49 | 39 |
|
50 |
| -/* {{{ spl_instantiate_arg_n */ |
51 |
| -static inline void spl_instantiate_arg_n(zend_class_entry *pce, zval *retval, int argc, zval *argv) |
| 40 | +static inline void spl_instantiate_arg_n( |
| 41 | + zend_class_entry *pce, zval *retval, uint32_t argc, zval *argv) |
52 | 42 | {
|
53 |
| - zend_function *func = pce->constructor; |
54 |
| - zend_fcall_info fci; |
55 |
| - zend_fcall_info_cache fcc; |
56 |
| - zval dummy; |
57 |
| - |
58 |
| - spl_instantiate(pce, retval); |
59 |
| - |
60 |
| - fci.size = sizeof(zend_fcall_info); |
61 |
| - ZVAL_STR(&fci.function_name, func->common.function_name); |
62 |
| - fci.object = Z_OBJ_P(retval); |
63 |
| - fci.retval = &dummy; |
64 |
| - fci.param_count = argc; |
65 |
| - fci.params = argv; |
66 |
| - |
67 |
| - fcc.function_handler = func; |
68 |
| - fcc.called_scope = pce; |
69 |
| - fcc.object = Z_OBJ_P(retval); |
70 |
| - |
71 |
| - zend_call_function(&fci, &fcc); |
| 43 | + object_init_ex(retval, pce); |
| 44 | + zend_call_known_instance_method(pce->constructor, Z_OBJ_P(retval), NULL, argc, argv); |
72 | 45 | }
|
73 |
| -/* }}} */ |
74 | 46 |
|
75 | 47 | #endif /* SPL_ENGINE_H */
|
0 commit comments