Skip to content

Change getThis() into ZEND_THIS where possible #13641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ ZEND_METHOD(Closure, bindTo)
Z_PARAM_OBJ_OR_STR_OR_NULL(scope_obj, scope_str)
ZEND_PARSE_PARAMETERS_END();

do_closure_bind(return_value, getThis(), newthis, scope_obj, scope_str);
do_closure_bind(return_value, ZEND_THIS, newthis, scope_obj, scope_str);
}

static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_weakrefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ ZEND_METHOD(WeakReference, get)
{
ZEND_PARSE_PARAMETERS_NONE();

zend_weakref_get(getThis(), return_value);
zend_weakref_get(ZEND_THIS, return_value);
}

static zend_object *zend_weakmap_create_object(zend_class_entry *ce)
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/* {{{ com_create_instance - ctor for COM class */
PHP_METHOD(com, __construct)
{
zval *object = getThis();
zval *object = ZEND_THIS;
zend_string *server_name = NULL;
HashTable *server_params = NULL;
php_com_dotnet_object *obj;
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_dotnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static HRESULT dotnet_init(char **p_where)
/* {{{ com_dotnet_create_instance - ctor for DOTNET class */
PHP_METHOD(dotnet, __construct)
{
zval *object = getThis();
zval *object = ZEND_THIS;
php_com_dotnet_object *obj;
char *assembly_name, *datatype_name;
size_t assembly_name_len, datatype_name_len;
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)

#define CPH_METHOD(fname) PHP_METHOD(COMPersistHelper, fname)

#define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis());
#define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(ZEND_THIS);

#define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); RETURN_THROWS(); }

Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/com_variant.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ PHP_METHOD(variant, __construct)
{
/* VARTYPE == unsigned short */ zend_long vt = VT_EMPTY;
zend_long codepage = CP_ACP;
zval *object = getThis();
zval *object = ZEND_THIS;
php_com_dotnet_object *obj;
zval *zvalue = NULL;
HRESULT res;
Expand Down
2 changes: 1 addition & 1 deletion ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -6524,7 +6524,7 @@ ZEND_METHOD(ReflectionReference, getId)
RETURN_THROWS();
}

intern = Z_REFLECTION_P(getThis());
intern = Z_REFLECTION_P(ZEND_THIS);
if (Z_TYPE(intern->obj) != IS_REFERENCE) {
_DO_THROW("Corrupted ReflectionReference object");
RETURN_THROWS();
Expand Down
2 changes: 1 addition & 1 deletion ext/sqlite3/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ PHP_METHOD(SQLite3Stmt, getSQL)
{
php_sqlite3_stmt *stmt_obj;
bool expanded = 0;
zval *object = getThis();
zval *object = ZEND_THIS;
stmt_obj = Z_SQLITE3_STMT_P(object);
int bind_rc;

Expand Down
8 changes: 4 additions & 4 deletions ext/zend_test/fiber.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static zend_always_inline void delegate_transfer_result(

static ZEND_METHOD(_ZendTestFiber, __construct)
{
zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(getThis());
zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(ZEND_THIS);

ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_FUNC(fiber->fci, fiber->fci_cache)
Expand All @@ -240,7 +240,7 @@ static ZEND_METHOD(_ZendTestFiber, __construct)

static ZEND_METHOD(_ZendTestFiber, start)
{
zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(getThis());
zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(ZEND_THIS);
zval *params;
uint32_t param_count;
zend_array *named_params;
Expand Down Expand Up @@ -304,7 +304,7 @@ static ZEND_METHOD(_ZendTestFiber, resume)
Z_PARAM_ZVAL(value);
ZEND_PARSE_PARAMETERS_END();

fiber = (zend_test_fiber *) Z_OBJ_P(getThis());
fiber = (zend_test_fiber *) Z_OBJ_P(ZEND_THIS);

if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL)) {
zend_throw_error(NULL, "Cannot resume a fiber that is not suspended");
Expand All @@ -325,7 +325,7 @@ static ZEND_METHOD(_ZendTestFiber, pipeTo)
Z_PARAM_FUNC(fci, fci_cache)
ZEND_PARSE_PARAMETERS_END();

zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(getThis());
zend_test_fiber *fiber = (zend_test_fiber *) Z_OBJ_P(ZEND_THIS);
zend_test_fiber *target = (zend_test_fiber *) zend_test_fiber_class->create_object(zend_test_fiber_class);

target->fci = fci;
Expand Down