1
0
Fork 0

Fix code formatting

This commit is contained in:
Duncan Ogilvie 2025-08-17 20:36:57 +02:00
parent c84549a8ad
commit 9e6fc87773
3 changed files with 10 additions and 7 deletions

View File

@ -93,9 +93,11 @@ static int SymAutoComplete(const char* Search, char** Buffer, int MaxSymbols)
}
}
if (count < MaxSymbols) {
if(count < MaxSymbols)
{
auto labels = LabelFindPrefix(prefix, MaxSymbols - count, caseSensitiveAutoComplete);
for (auto& label: labels) {
for(auto & label : labels)
{
Buffer[count] = (char*)BridgeAlloc(label.size() + 1);
memcpy(Buffer[count], label.c_str(), label.size() + 1);
count++;

View File

@ -163,19 +163,20 @@ bool LabelGetInfo(duint Address, LABELSINFO* info)
return labels.Get(Labels::VaKey(Address), *info);
}
std::vector<std::string> LabelFindPrefix(const std::string& prefix, int maxCount, bool isCaseSensitive)
std::vector<std::string> LabelFindPrefix(const std::string & prefix, int maxCount, bool isCaseSensitive)
{
std::vector<std::string> outputs;
auto cmp = isCaseSensitive? strncmp : _strnicmp;
auto cmp = isCaseSensitive ? strncmp : _strnicmp;
size_t prefixSize = prefix.size();
labels.GetWhere([&](const LABELSINFO & value)
{
if ((int)outputs.size() >= maxCount)
if((int)outputs.size() >= maxCount)
{
return true;
}
if (cmp(prefix.c_str(), value.text.c_str(), prefixSize) != 0) {
if(cmp(prefix.c_str(), value.text.c_str(), prefixSize) != 0)
{
return false;
}
outputs.push_back(value.text);

View File

@ -20,6 +20,6 @@ void LabelCacheLoad(JSON root);
void LabelClear();
void LabelGetList(std::vector<LABELSINFO> & list);
bool LabelGetInfo(duint Address, LABELSINFO* info);
std::vector<std::string> LabelFindPrefix(const std::string& prefix, int maxCount, bool isCaseSensitive);
std::vector<std::string> LabelFindPrefix(const std::string & prefix, int maxCount, bool isCaseSensitive);
#endif // _LABEL_H