Skip to content

Commit

Permalink
Refactor object access for parameter preparation.
Browse files Browse the repository at this point in the history
Improve code readability and maintainability by using the Z_OBJ macro for object access. This change ensures a more consistent approach to handling object instances within the code. Additionally, remove redundant call to prepare_intercept_params for cleaner execution logic.
  • Loading branch information
koriym committed Dec 6, 2024
1 parent 5fba231 commit d052a53
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rayaop.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ PHP_RAYAOP_API php_rayaop_intercept_info *php_rayaop_find_intercept_info(const c

/* Parameter preparation and cleanup */
static bool prepare_intercept_params(zend_execute_data *execute_data, zval *params, php_rayaop_intercept_info *info) {
if (!execute_data->This.value.obj) {
if (!Z_OBJ(execute_data->This)) {
php_rayaop_handle_error(RAYAOP_E_INVALID_HANDLER, "Object instance is NULL");
return false;
}

ZVAL_OBJ(&params[0], execute_data->This.value.obj);
ZVAL_OBJ(&params[0], Z_OBJ(execute_data->This));
ZVAL_STR_COPY(&params[1], info->method_name);

array_init(&params[2]);
Expand Down Expand Up @@ -205,7 +205,6 @@ static void rayaop_execute_ex(zend_execute_data *execute_data) {
zval retval;
zval params[3];

prepare_intercept_params(execute_data, params, info);
if (!prepare_intercept_params(execute_data, params, info)) {
cleanup_intercept_params(params);
RAYAOP_G(is_intercepting) = 0;
Expand Down

0 comments on commit d052a53

Please sign in to comment.