Skip to content

Commit 24380ff

Browse files
committed
Optimized various python calls from c++.
1 parent b8afdb6 commit 24380ff

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/core/modules/listeners/listeners_manager.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
// Includes.
3232
//-----------------------------------------------------------------------------
3333
#include "utilities/wrap_macros.h"
34-
#include "utilities/call_python.h"
3534
#include "utlvector.h"
3635

3736

@@ -54,7 +53,7 @@
5453
for(int i = 0; i < mngr->m_vecCallables.Count(); i++) \
5554
{ \
5655
BEGIN_BOOST_PY() \
57-
CALL_PY_FUNC(mngr->m_vecCallables[i].ptr(), ##__VA_ARGS__); \
56+
mngr->m_vecCallables[i](##__VA_ARGS__); \
5857
END_BOOST_PY_NORET() \
5958
}
6059

@@ -66,7 +65,7 @@
6665
for(int i = 0; i < mngr->m_vecCallables.Count(); i++) \
6766
{ \
6867
BEGIN_BOOST_PY() \
69-
return_var = CALL_PY_FUNC(mngr->m_vecCallables[i].ptr(), ##__VA_ARGS__); \
68+
return_var = mngr->m_vecCallables[i](##__VA_ARGS__); \
7069
action \
7170
END_BOOST_PY_NORET() \
7271
}

src/core/modules/memory/memory_hooks.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "memory_utilities.h"
3232
#include "memory_pointer.h"
3333
#include "utilities/wrap_macros.h"
34-
#include "utilities/call_python.h"
3534
#include "utilities/sp_util.h"
3635

3736
#include "boost/python.hpp"
@@ -123,9 +122,9 @@ bool SP_HookHandler(HookType_t eHookType, CHook* pHook)
123122
BEGIN_BOOST_PY()
124123
object pyretval;
125124
if (eHookType == HOOKTYPE_PRE)
126-
pyretval = CALL_PY_FUNC((*it).ptr(), stackdata);
125+
pyretval = (*it)(stackdata);
127126
else
128-
pyretval = CALL_PY_FUNC((*it).ptr(), stackdata, retval);
127+
pyretval = (*it)(stackdata, retval);
129128

130129
if (!pyretval.is_none())
131130
{

src/core/sp_main.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ SpewRetval_t SP_SpewOutput( SpewType_t spewType, const tchar *pMsg )
196196
for(int i = 0; i < GetOnServerOutputListenerManager()->m_vecCallables.Count(); i++)
197197
{
198198
BEGIN_BOOST_PY()
199-
object return_value = CALL_PY_FUNC(
200-
GetOnServerOutputListenerManager()->m_vecCallables[i].ptr(),
199+
object return_value = GetOnServerOutputListenerManager()->m_vecCallables[i](
201200
(MessageSeverity) spewType,
202201
pMsg);
203202

@@ -224,8 +223,7 @@ class SPLoggingListener: public ILoggingListener
224223
for(int i = 0; i < GetOnServerOutputListenerManager()->m_vecCallables.Count(); i++)
225224
{
226225
BEGIN_BOOST_PY()
227-
object return_value = CALL_PY_FUNC(
228-
GetOnServerOutputListenerManager()->m_vecCallables[i].ptr(),
226+
object return_value = GetOnServerOutputListenerManager()->m_vecCallables[i](
229227
(MessageSeverity) pContext->m_Severity,
230228
pMessage);
231229

0 commit comments

Comments
 (0)