Skip to content

Commit

Permalink
Optimize void return in squirrel function call stub
Browse files Browse the repository at this point in the history
  • Loading branch information
z33ky committed Nov 18, 2024
1 parent d97cc86 commit 79399ea
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sp/src/vscript/vscript_squirrel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,15 @@ SQInteger function_stub(HSQUIRRELVM vm)
{
Assert(script_retval.m_type == pFunc->m_desc.m_ReturnType);

PushVariant(vm, script_retval);
sq_retval = 1;
if (pFunc->m_desc.m_ReturnType != FIELD_VOID)
{
PushVariant(vm, script_retval);
sq_retval = 1;
}
else
{
sq_retval = 0;
}
}

Assert(!(script_retval.m_flags & SV_FREE));
Expand Down

0 comments on commit 79399ea

Please sign in to comment.