Change TableVal::RecoverIndex() to return IntrusivePtr

This commit is contained in:
Jon Siwek 2020-03-23 12:48:21 -07:00
parent 0b5a18495d
commit b045ce4bb3
11 changed files with 45 additions and 90 deletions

View file

@ -207,7 +207,7 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
auto tbl = tv->AsTable();
auto it = tbl->InitForIteration();
ListVal* lv = new ListVal(TYPE_ANY);
auto lv = make_intrusive<ListVal>(TYPE_ANY);
struct HashKeyComparer {
bool operator()(const HashKey* a, const HashKey* b) const
@ -229,7 +229,7 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
while ( tbl->NextEntry(k, it) )
{
hashkeys[k] = idx++;
lv->Append(tv->RecoverIndex(k));
lv->Append(tv->RecoverIndex(k).release());
}
for ( auto& kv : hashkeys )
@ -242,10 +242,7 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
if ( ! (kp1 = SingleValHash(type_check, kp1, key->Type(), key,
false)) )
{
Unref(lv);
return 0;
}
if ( ! v->Type()->IsSet() )
{
@ -253,14 +250,10 @@ char* CompositeHash::SingleValHash(int type_check, char* kp0,
if ( ! (kp1 = SingleValHash(type_check, kp1, val->Type(),
val.get(), false)) )
{
Unref(lv);
return 0;
}
}
}
Unref(lv);
}
break;