mirror of
https://github.com/albertodemichelis/squirrel.git
synced 2026-01-11 22:18:43 +01:00
Fix creating unnecessary temporary object with refcount
Using the SQObject& is enough for HashObj() function.
In the following code
RefTable::RefNode *RefTable::Get(SQObject &obj,SQHash &mainpos,RefNode **prev,bool add)
{
RefNode *ref;
mainpos = ::HashObj(obj)&(_numofslots-1);
obj was SQObject and because HashObj() accepted SQObjectPtr&, a temporary
SQObjectPtr was created and refcounting was performed, which only lead to
unnecessary overhead.
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
|
||||
#define hashptr(p) ((SQHash)(((SQInteger)p) >> 3))
|
||||
|
||||
inline SQHash HashObj(const SQObjectPtr &key)
|
||||
inline SQHash HashObj(const SQObject &key)
|
||||
{
|
||||
switch(sq_type(key)) {
|
||||
case OT_STRING: return _string(key)->_hash;
|
||||
|
||||
Reference in New Issue
Block a user