mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Reserve vectors before pushing and other code quality changes (#11161)
This commit is contained in:
@@ -965,13 +965,14 @@ InventoryList * Inventory::getList(const std::string &name)
|
||||
{
|
||||
s32 i = getListIndex(name);
|
||||
if(i == -1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return m_lists[i];
|
||||
}
|
||||
|
||||
std::vector<const InventoryList*> Inventory::getLists()
|
||||
{
|
||||
std::vector<const InventoryList*> lists;
|
||||
lists.reserve(m_lists.size());
|
||||
for (auto list : m_lists) {
|
||||
lists.push_back(list);
|
||||
}
|
||||
@@ -990,11 +991,11 @@ bool Inventory::deleteList(const std::string &name)
|
||||
return true;
|
||||
}
|
||||
|
||||
const InventoryList * Inventory::getList(const std::string &name) const
|
||||
const InventoryList *Inventory::getList(const std::string &name) const
|
||||
{
|
||||
s32 i = getListIndex(name);
|
||||
if(i == -1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return m_lists[i];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user