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:
VasiliyRyabtsev
2020-10-29 00:22:00 +03:00
parent a21721642e
commit b4f600ebc0

View File

@ -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;