[PATCH] new_tuple PyRep cleanup

View previous topic View next topic Go down

[PATCH] new_tuple PyRep cleanup

Post by Cometo on Sun Jul 17, 2016 11:44 am

Remove new_tuple(PyRep+) functions and replace with scalable std::initializer_list implementation.

Code:

diff --git a/src/eve-common/cache/CachedObjectMgr.cpp b/src/eve-common/cache/CachedObjectMgr.cpp
index 9e0bb25..0bb4da5 100644
--- a/src/eve-common/cache/CachedObjectMgr.cpp
+++ b/src/eve-common/cache/CachedObjectMgr.cpp
@@ -720,7 +720,7 @@ PyObject *PyCachedObject::Encode()
 {
     PyTuple *arg_tuple = new PyTuple(7);
 
-    arg_tuple->items[0] = new_tuple(new PyLong(timestamp), new PyInt(version));
+    arg_tuple->items[0] = new_tuple( {new PyLong(timestamp), new PyInt(version)} );
 
     arg_tuple->items[1] = new PyNone();
 
diff --git a/src/eve-common/python/PyRep.cpp b/src/eve-common/python/PyRep.cpp
index d3f47a1..83833d5 100644
--- a/src/eve-common/python/PyRep.cpp
+++ b/src/eve-common/python/PyRep.cpp
@@ -868,7 +868,7 @@ PyRep *PyObjectEx_Type1::createBuiltinSetList(std::vector<int32> vals)
     {
         list->AddItem(new PyInt(val));
     }
-    PyRep *set = new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple(list));
+    PyRep *set = new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple( {list} ));
     return set;
 }
 
@@ -1177,33 +1177,18 @@ PyTuple * new_tuple(const char* arg1, PyRep* arg2, PyRep* arg3)
 }
 
 /* @note we should increase ref here.... but don't make it to complicated to use... for now... */
-PyTuple * new_tuple(PyRep* arg1, PyRep* arg2, PyRep* arg3)
+PyTuple *new_tuple(std::initializer_list<PyRep*> args)
 {
-    PyTuple * res = new PyTuple(3);
-    res->SetItem(0, arg1);
-    res->SetItem(1, arg2);
-    res->SetItem(2, arg3);
-    return res;
-}
-
-PyTuple * new_tuple(PyRep* arg1, PyRep* arg2)
-{
-    PyTuple * res = new PyTuple(2);
-    res->SetItem(0, arg1);
-    res->SetItem(1, arg2);
-    return res;
-}
-
-PyTuple * new_tuple(PyRep* arg1)
-{
-    PyTuple * res = new PyTuple(1);
-    res->SetItem(0, arg1);
-    return res;
+    PyTuple *rtn = new PyTuple(args.size());
+    int i = 0;
+    for(PyRep *arg : args)
+        rtn->SetItem(i++, arg);
+    return rtn;
 }
 
 PyTuple *new_tuple001(PyRep *arg1)
 {
-    return new_tuple(new PyInt(0), new_tuple(new PyInt(0), new_tuple(new PyInt(1), new_tuple(arg1))));
+    return new_tuple( {new PyInt(0), new_tuple( {new PyInt(0), new_tuple( {new PyInt(1), new_tuple( {arg1} )} )} )} );
 }
 
 
@@ -1221,3 +1206,4 @@ PyDict *new_dict(PyRep *key1, PyRep *value1, PyRep *key2, PyRep *value2)
     rtn->SetItem(key2, value2);
     return rtn;
 }
+
diff --git a/src/eve-common/python/PyRep.h b/src/eve-common/python/PyRep.h
index 6da883e..28cc89b 100644
--- a/src/eve-common/python/PyRep.h
+++ b/src/eve-common/python/PyRep.h
@@ -1030,9 +1030,7 @@ PyTuple * new_tuple(const char* arg1, const char* arg2, const char* arg3);
 PyTuple * new_tuple(const char* arg1, const char* arg2, PyTuple* arg3);
 /* mixed */
 PyTuple * new_tuple(const char* arg1, PyRep* arg2, PyRep* arg3);
-PyTuple * new_tuple(PyRep* arg1);
-PyTuple * new_tuple(PyRep* arg1, PyRep* arg2);
-PyTuple * new_tuple(PyRep* arg1, PyRep* arg2, PyRep* arg3);
+PyTuple *new_tuple(std::initializer_list<PyRep*> args);
 PyTuple *new_tuple001(PyRep *arg1);
 
 PyDict *new_dict(PyRep *key1, PyRep *value1);
diff --git a/src/eve-common/python/classes/PyDatabase.cpp b/src/eve-common/python/classes/PyDatabase.cpp
index 54f4d73..47fd48b 100644
--- a/src/eve-common/python/classes/PyDatabase.cpp
+++ b/src/eve-common/python/classes/PyDatabase.cpp
@@ -132,13 +132,13 @@ PyTuple* DBRowDescriptor::_CreateArgs()
 /* CRowSet                                                              */
 /************************************************************************/
 CRowSet::CRowSet( DBRowDescriptor** rowDesc)
-: PyObjectEx_Type2(new_tuple(new PyToken("carbon.common.script.sys.crowset.CRowset")), _CreateKeywords(*rowDesc))
+: PyObjectEx_Type2(new_tuple( {new PyToken("carbon.common.script.sys.crowset.CRowset")} ), _CreateKeywords(*rowDesc))
 {
     *rowDesc = NULL;
 }
 
 CRowSet::CRowSet(DBRowDescriptor** rowDesc, PyTuple** columnList)
-: PyObjectEx_Type2(new_tuple(new PyToken("carbon.common.script.sys.crowset.CRowset")), _CreateKeywords(new PyObjectEx(false, new_tuple(*rowDesc, *columnList))))
+: PyObjectEx_Type2(new_tuple( {new PyToken("carbon.common.script.sys.crowset.CRowset")} ), _CreateKeywords(new PyObjectEx(false, new_tuple( {*rowDesc, *columnList} ))))
 {
     *rowDesc = NULL;
     *columnList = NULL;
@@ -177,7 +177,7 @@ PyDict* CRowSet::_CreateKeywords(PyRep* rowDesc)
 /* CIndexedRowSet                                                              */
 /************************************************************************/
 CIndexedRowSet::CIndexedRowSet( DBRowDescriptor** rowDesc)
-: PyObjectEx_Type2(new_tuple(new PyToken("dbutil.CIndexedRowset")), _CreateKeywords(*rowDesc))
+: PyObjectEx_Type2(new_tuple( {new PyToken("dbutil.CIndexedRowset")} ), _CreateKeywords(*rowDesc))
 {
     *rowDesc = NULL;
 }
@@ -218,7 +218,7 @@ PyDict* CIndexedRowSet::_CreateKeywords(DBRowDescriptor* rowDesc)
 /* CFilterRowSet                                                              */
 /************************************************************************/
 CFilterRowSet::CFilterRowSet( DBRowDescriptor** rowDesc)
-: PyObjectEx_Type2(new_tuple(new PyToken("dbutil.CFilterRowset")), _CreateKeywords(*rowDesc))
+: PyObjectEx_Type2(new_tuple( {new PyToken("dbutil.CFilterRowset")} ), _CreateKeywords(*rowDesc))
 {
     *rowDesc = NULL;
 }
diff --git a/src/eve-core/eve-core.h b/src/eve-core/eve-core.h
index 0bea70d..17602a1 100644
--- a/src/eve-core/eve-core.h
+++ b/src/eve-core/eve-core.h
@@ -70,6 +70,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <ctime>
+#include <iostream>
 
 // Standard Template Library includes
 #include <algorithm>
diff --git a/src/eve-server/Client.cpp b/src/eve-server/Client.cpp
index c5098a0..ff985be 100644
--- a/src/eve-server/Client.cpp
+++ b/src/eve-server/Client.cpp
@@ -822,7 +822,7 @@ void Client::_SendPingRequest()
 
     ping_req->userid = GetAccountID();
 
-    ping_req->payload = new_tuple( new PyList() ); //times
+    ping_req->payload = new_tuple( {new PyList()} ); //times
     ping_req->named_payload = new PyDict();
 
     fastQueuePacket(&ping_req);
diff --git a/src/eve-server/ClientSession.cpp b/src/eve-server/ClientSession.cpp
index 6250c5f..0861bed 100644
--- a/src/eve-server/ClientSession.cpp
+++ b/src/eve-server/ClientSession.cpp
@@ -38,7 +38,7 @@
 ClientSession::ClientSession() : mSession( new PyDict ), mDirty( false )
 {
     /* default value of attribute */
-    PyTuple* v = new_tuple(new PyNone, new PyLong(0x4000000000000000LL));
+    PyTuple* v = new_tuple( {new PyNone, new PyLong(0x4000000000000000LL)} );
     mSession->SetItemString( "role", v );
 }
 
diff --git a/src/eve-server/account/BrowserLockdownSvc.cpp b/src/eve-server/account/BrowserLockdownSvc.cpp
index adb18e1..3187d5b 100644
--- a/src/eve-server/account/BrowserLockdownSvc.cpp
+++ b/src/eve-server/account/BrowserLockdownSvc.cpp
@@ -63,7 +63,7 @@ PyString:"util.CachedObject"
 
     arg_tuple->SetItem(0, new_tuple("Method Call", "server", new_tuple("browserLockdownSvc", "GetFlaggedSitesHash")));
     arg_tuple->SetItem(1, new PyInt(0xACECD));
-    arg_tuple->SetItem(2, new_tuple(new PyLong(0x1CC26986D4B75A0LL), new PyInt(0xC017) ) );
+    arg_tuple->SetItem(2, new_tuple( {new PyLong(0x1CC26986D4B75A0LL), new PyInt(0xC017)} ) );
 
     return new PyObject( "util.CachedObject" , arg_tuple );
 }
diff --git a/src/eve-server/account/InfoGatheringMgr.cpp b/src/eve-server/account/InfoGatheringMgr.cpp
index c2ce8ed..f7f11ad 100644
--- a/src/eve-server/account/InfoGatheringMgr.cpp
+++ b/src/eve-server/account/InfoGatheringMgr.cpp
@@ -76,7 +76,7 @@ PyResult InfoGatheringMgr::Handle_GetStateAndConfig(PyCallArgs &call)
     aggregates->SetItem(new PyInt(33), PyObjectEx_Type1::createBuiltinSetList({1, 2, 6}));
     aggregates->SetItem(new PyInt(34), PyObjectEx_Type1::createBuiltinSetList({1, 2, 6}));
     rsp->SetItemString("infoTypeAggregates", aggregates);
-    rsp->SetItemString("infoTypesOncePerRun", new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple(new PyList())));
+    rsp->SetItemString("infoTypesOncePerRun", new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple( {new PyList()} )));
     PyDict *params = new PyDict();
     params->SetItem(new PyInt(2), PyObjectEx_Type1::createBuiltinSetList({0, 1, 2, 3, 4}));
     params->SetItem(new PyInt(3), PyObjectEx_Type1::createBuiltinSetList({0, 1, 2, 3, 6}));
diff --git a/src/eve-server/character/CharUnboundMgrService.cpp b/src/eve-server/character/CharUnboundMgrService.cpp
index f743b5b..83b39b1 100644
--- a/src/eve-server/character/CharUnboundMgrService.cpp
+++ b/src/eve-server/character/CharUnboundMgrService.cpp
@@ -461,7 +461,7 @@ PyResult CharUnboundMgrService::Handle_GetCharacterSelectionData(PyCallArgs &cal
         codelog(SERVICE__ERROR, "Failed to get row for userDetails");
         return NULL;
     }
-    rtn->SetItem(0, new_tuple(DBRowToKeyVal(row)));
+    rtn->SetItem(0, new_tuple( {DBRowToKeyVal(row)} ));
 
     // trainingEnds
     rtn->SetItem(1, new PyList(0));
diff --git a/src/eve-server/character/CrimeWatchService.cpp b/src/eve-server/character/CrimeWatchService.cpp
index 6b3bd00..9641fad 100644
--- a/src/eve-server/character/CrimeWatchService.cpp
+++ b/src/eve-server/character/CrimeWatchService.cpp
@@ -174,10 +174,10 @@ PyResult CrimeWatchServiceBound::Handle_GetClientStates(PyCallArgs &call)
     // Set first as tuple
     PyTuple *myCombatTimers = new PyTuple(4);
     // If active the PyNone should be a PyInt with the expire timestamp.
-    PyTuple *weaponTimerState = new_tuple(new PyInt(weaponsTimerStateIdle), new PyNone());
-    PyTuple *pvpTimerState = new_tuple(new PyInt(pvpTimerStateIdle), new PyNone());
-    PyTuple *npcTimerState = new_tuple(new PyInt(npcTimerStateIdle), new PyNone());
-    PyTuple *criminalTimerState = new_tuple(new PyInt(criminalTimerStateIdle), new PyNone());
+    PyTuple *weaponTimerState = new_tuple( {new PyInt(weaponsTimerStateIdle), new PyNone()} );
+    PyTuple *pvpTimerState = new_tuple( {new PyInt(pvpTimerStateIdle), new PyNone()} );
+    PyTuple *npcTimerState = new_tuple( {new PyInt(npcTimerStateIdle), new PyNone()} );
+    PyTuple *criminalTimerState = new_tuple( {new PyInt(criminalTimerStateIdle), new PyNone()} );
     myCombatTimers->SetItem(0, weaponTimerState);
     myCombatTimers->SetItem(1, pvpTimerState);
     myCombatTimers->SetItem(2, npcTimerState);
@@ -191,10 +191,10 @@ PyResult CrimeWatchServiceBound::Handle_GetClientStates(PyCallArgs &call)
     PyTuple *flaggedCharacters = new PyTuple(2);
     // TO-DO: populate criminal list with characterIDs of characters with criminal flag.
     PyList *criminalList = new PyList();
-    PyObjectEx_Type1 *criminals = new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple(criminalList));
+    PyObjectEx_Type1 *criminals = new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple( {criminalList} ));
     // TO-DO: populate suspect list with characterIDs of characters with suspect flag.
     PyList *suspectList = new PyList();
-    PyObjectEx_Type1 *suspects = new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple(suspectList));
+    PyObjectEx_Type1 *suspects = new PyObjectEx_Type1(new PyToken("__builtin__.set"), new_tuple( {suspectList} ));
     flaggedCharacters->SetItem(0, criminals);
     flaggedCharacters->SetItem(1, suspects);
 
diff --git a/src/eve-server/character/Skill.cpp b/src/eve-server/character/Skill.cpp
index e15d393..13e4edf 100644
--- a/src/eve-server/character/Skill.cpp
+++ b/src/eve-server/character/Skill.cpp
@@ -142,8 +142,8 @@ void Skill::sendSkillChangeNotice(Client *client, std::string eventName)
         {
             event = new PyString(eventName);
         }
-        PyTuple *tuple = new_tuple(skillInfos, event, canTrain);
-        PyTuple *newQueue = new_tuple(new PyInt(0), new_tuple(new PyInt(0), new_tuple(new PyInt(1), tuple)));
+        PyTuple *tuple = new_tuple( {skillInfos, event, canTrain} );
+        PyTuple *newQueue = new_tuple( {new PyInt(0), new_tuple( {new PyInt(0), new_tuple( {new PyInt(1), tuple} )} )} );
         client->SendNotification("OnServerSkillsChanged", "charid", &newQueue, false);
     }
 }
diff --git a/src/eve-server/character/SkillMgrService.cpp b/src/eve-server/character/SkillMgrService.cpp
index 9b2b639..67d7cd6 100644
--- a/src/eve-server/character/SkillMgrService.cpp
+++ b/src/eve-server/character/SkillMgrService.cpp
@@ -181,7 +181,7 @@ PyResult SkillMgr2Bound::Handle_GetSkillQueueAndFreePoints(PyCallArgs &call)
     CharacterRef chr = call.client->GetChar();
     PyList *skillList = chr->getSkillQueue();
     PyInt *freePts = new PyInt(0);
-    return new_tuple(skillList, freePts);
+    return new_tuple( {skillList, freePts} );
 }
 
 PyResult SkillMgr2Bound::Handle_GetSkillHistory(PyCallArgs& call)
diff --git a/src/eve-server/corporation/CorpStationMgrService.cpp b/src/eve-server/corporation/CorpStationMgrService.cpp
index 3b3801f..cccdff4 100644
--- a/src/eve-server/corporation/CorpStationMgrService.cpp
+++ b/src/eve-server/corporation/CorpStationMgrService.cpp
@@ -592,7 +592,7 @@ PyResult CorpStationMgrIMBound::Handle_GetStationOffices( PyCallArgs& call )
 
     arg_tuple->SetItem(0, itr_1);
     arg_tuple->SetItem(1, new PySubStream( new PyList() ) );
-    arg_tuple->SetItem(2, new_tuple(new PyLong(129533580031608440LL), new PyInt(52428965) ) );
+    arg_tuple->SetItem(2, new_tuple( {new PyLong(129533580031608440LL), new PyInt(52428965)} ) );
     return new PyObject( "objectCaching.CachedMethodCallResult", arg_tuple );
 }
 
diff --git a/src/eve-server/dogmaim/DogmaIMService.cpp b/src/eve-server/dogmaim/DogmaIMService.cpp
index 37a4d66..4f680d2 100644
--- a/src/eve-server/dogmaim/DogmaIMService.cpp
+++ b/src/eve-server/dogmaim/DogmaIMService.cpp
@@ -479,7 +479,7 @@ PyResult DogmaIMBound::Handle_GetWeaponBankInfoForShip( PyCallArgs& call )
 class BuiltinSet : public PyObjectEx_Type1
 {
 public:
-    BuiltinSet() : PyObjectEx_Type1( new PyToken("collections.defaultdict"), new_tuple(new PyToken("__builtin__.set")) ) {}
+    BuiltinSet() : PyObjectEx_Type1( new PyToken("collections.defaultdict"), new_tuple( {new PyToken("__builtin__.set")} ) ) {}
 };
 
 PyResult DogmaIMBound::Handle_GetAllInfo( PyCallArgs& call )
@@ -642,8 +642,8 @@ PyResult DogmaIMBound::Handle_InjectSkillIntoBrain(PyCallArgs& call)
     // TO-DO: find out if the can be false.
     // i.e. if skill is level 5 or char injects skill with another char already training.
     PyBool *canTrain = new PyBool(true);
-    PyTuple *tuple = new_tuple(skillInfos, event, canTrain);
-    PyTuple *newQueue = new_tuple(new PyInt(0), new_tuple(new PyInt(0), new_tuple(new PyInt(1), tuple)));
+    PyTuple *tuple = new_tuple( {skillInfos, event, canTrain} );
+    PyTuple *newQueue = new_tuple( {new PyInt(0), new_tuple( {new PyInt(0), new_tuple( {new PyInt(1), tuple} )} )} );
     call.client->SendNotification("OnServerSkillsChanged", "charid", &newQueue, false);
 
     return NULL;
diff --git a/src/eve-server/inventory/InvBrokerService.cpp b/src/eve-server/inventory/InvBrokerService.cpp
index 7c325e5..5c76a1e 100644
--- a/src/eve-server/inventory/InvBrokerService.cpp
+++ b/src/eve-server/inventory/InvBrokerService.cpp
@@ -90,8 +90,8 @@ PyResult InvBrokerService::Handle_GetItemDescriptor(PyCallArgs &call)
     // from Inventory::List
 
     PyList *keywords = new PyList();
-    keywords->AddItem(new_tuple(new PyString("stacksize"), new PyToken("eve.common.script.sys.eveCfg.StackSize")));
-    keywords->AddItem(new_tuple(new PyString("singleton"), new PyToken("eve.common.script.sys.eveCfg.Singleton")));
+    keywords->AddItem(new_tuple( {new PyString("stacksize"), new PyToken("eve.common.script.sys.eveCfg.StackSize")} ));
+    keywords->AddItem(new_tuple( {new PyString("singleton"), new PyToken("eve.common.script.sys.eveCfg.Singleton")} ));
 
     DBRowDescriptor* header = new DBRowDescriptor(keywords);
     header->AddColumn( "itemID",     DBTYPE_I8 );
diff --git a/src/eve-server/inventory/Inventory.cpp b/src/eve-server/inventory/Inventory.cpp
index d72b345..8d7cd41 100644
--- a/src/eve-server/inventory/Inventory.cpp
+++ b/src/eve-server/inventory/Inventory.cpp
@@ -231,8 +231,8 @@ void Inventory::DeleteContents()
 CRowSet* Inventory::List( EVEItemFlags _flag, uint32 forOwner ) const
 {
     PyList *keywords = new PyList();
-    keywords->AddItem(new_tuple(new PyString("stacksize"), new PyToken("util.StackSize")));
-    keywords->AddItem(new_tuple(new PyString("singleton"), new PyToken("util.Singleton")));
+    keywords->AddItem(new_tuple( {new PyString("stacksize"), new PyToken("util.StackSize")} ));
+    keywords->AddItem(new_tuple( {new PyString("singleton"), new PyToken("util.Singleton")} ));
 
     DBRowDescriptor* header = new DBRowDescriptor(keywords);
     header->AddColumn( "itemID",     DBTYPE_I8 );
@@ -529,8 +529,8 @@ void Inventory::StackAll(EVEItemFlags locFlag, uint32 forOwner)
             // Send notice of deleted items.
             PyDict *dict = new PyDict();
             dict->SetItem(new PyInt(9), new PyInt(1));
-            PyTuple *tuple = new_tuple(items, dict);
-            PyTuple *newQueue = new_tuple(new PyInt(0), new_tuple(new PyInt(0), new_tuple(new PyInt(1), tuple)));
+            PyTuple *tuple = new_tuple( {items, dict} );
+            PyTuple *newQueue = new_tuple( {new PyInt(0), new_tuple( {new PyInt(0), new_tuple( {new PyInt(1), tuple} )} )} );
             client->SendNotification("OnItemsChanged", "charid", &newQueue, false);
             // Alter amount.  This sends the item change notice.
             item->AlterQuantity(stackAmount);
diff --git a/src/eve-server/inventory/InventoryItem.cpp b/src/eve-server/inventory/InventoryItem.cpp
index ff35531..09a461f 100644
--- a/src/eve-server/inventory/InventoryItem.cpp
+++ b/src/eve-server/inventory/InventoryItem.cpp
@@ -1099,8 +1099,8 @@ void InventoryItem::sendItemChangeNotice(Client *client)
         items->AddItem(getPackedRow());
         PyDict *dict = new PyDict();
         dict->SetItem(new PyInt(9), new PyInt(1));
-        PyTuple *tuple = new_tuple(items, dict);
-        PyTuple *newQueue = new_tuple(new PyInt(0), new_tuple(new PyInt(0), new_tuple(new PyInt(1), tuple)));
+        PyTuple *tuple = new_tuple( {items, dict} );
+        PyTuple *newQueue = new_tuple( {new PyInt(0), new_tuple( {new PyInt(0), new_tuple( {new PyInt(1), tuple} )} )} );
         client->SendNotification("OnItemsChanged", "charid", &newQueue, false);
     }
 }
diff --git a/src/eve-server/services/bounty/BountyProxy.cpp b/src/eve-server/services/bounty/BountyProxy.cpp
index bd41c82..59b539d 100644
--- a/src/eve-server/services/bounty/BountyProxy.cpp
+++ b/src/eve-server/services/bounty/BountyProxy.cpp
@@ -118,7 +118,7 @@ PyResult BountyProxyService::Handle_GetBountiesAndKillRights(PyCallArgs &call)
         row->SetField("bounty", new PyLong(0));
         row->SetField("corporationID", new PyInt(0));
         row->SetField("allianceID", new PyInt(0));
-        resBounties->AddItem(new_tuple(new PyInt(id), row));
+        resBounties->AddItem(new_tuple( {new PyInt(id), row} ));
     }
     for(int i = 0; i < list1->size(); i++)
     {
@@ -187,7 +187,7 @@ PyResult BountyProxyService::Handle_GetBounties(PyCallArgs &call)
         row->SetField("bounty", new PyLong(0));
         row->SetField("corporationID", new PyInt(0));
         row->SetField("allianceID", new PyInt(0));
-        resBounties->AddItem(new_tuple(new PyInt(id), row));
+        resBounties->AddItem(new_tuple( {new PyInt(id), row} ));
     }
     return resBounties;
 }
diff --git a/src/eve-server/services/lscProxy/LscProxyService.cpp b/src/eve-server/services/lscProxy/LscProxyService.cpp
index 7f28058..d777c80 100644
--- a/src/eve-server/services/lscProxy/LscProxyService.cpp
+++ b/src/eve-server/services/lscProxy/LscProxyService.cpp
@@ -59,7 +59,7 @@ PyResult LSCProxyService::Handle_JoinChannels(PyCallArgs &call) {
      *              PyObject Rowset     // memberList
      */
     PyTuple *solChannel = new PyTuple(3);
-    solChannel->SetItem(0, new_tuple(new_tuple(new PyString("solarsystemid2"), new PyInt(call.client->GetSystemID()))));
+    solChannel->SetItem(0, new_tuple( {new_tuple( {new PyString("solarsystemid2"), new PyInt(call.client->GetSystemID())} )} ));
     solChannel->SetItem(1, new PyInt(1));
     util_Rowset rs;
     rs.header.push_back( "charID" );
@@ -68,7 +68,7 @@ PyResult LSCProxyService::Handle_JoinChannels(PyCallArgs &call) {
     rs.header.push_back( "warFactionID" );
     rs.header.push_back( "role" );
     rs.header.push_back( "extra" );
-    solChannel->SetItem(2, new_tuple(new PyNone(), new PyNone(), rs.Encode()));
+    solChannel->SetItem(2, new_tuple( {new PyNone(), new PyNone(), rs.Encode()} ));
 
     PyList *ret = new PyList(1);
     ret->SetItem(0, solChannel);
diff --git a/src/eve-server/ship/ShipService.cpp b/src/eve-server/ship/ShipService.cpp
index e507d61..16da55e 100644
--- a/src/eve-server/ship/ShipService.cpp
+++ b/src/eve-server/ship/ShipService.cpp
@@ -1126,7 +1126,7 @@ PyResult ShipBound::Handle_LeaveShip(PyCallArgs &call){
 class BuiltinSet : public PyObjectEx_Type1
 {
 public:
-    BuiltinSet() : PyObjectEx_Type1( new PyToken("collections.defaultdict"), new_tuple(new PyToken("__builtin__.set")) ) {}
+    BuiltinSet() : PyObjectEx_Type1( new PyToken("collections.defaultdict"), new_tuple( {new PyToken("__builtin__.set")} ) ) {}
 };
 
 PyResult ShipBound::Handle_ActivateShip(PyCallArgs &call)

Edit: Just a heads up, this is not going in a pull request due to larger than intended performance drop
This method of functions takes on average 1.5x longer than the current method implemented.

Cometo

Posts : 5
Join date : 2016-05-31

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum