Codechange: add a wrapper function to find all settings based on prefix (#9312)

This commit is contained in:
Patric Stout
2021-05-30 10:55:52 +02:00
committed by GitHub
parent e9e4588db1
commit 0c96884700
3 changed files with 19 additions and 23 deletions

View File

@@ -20,8 +20,6 @@
typedef LinkGraph::BaseNode Node;
typedef LinkGraph::BaseEdge Edge;
const SettingDesc *GetSettingDescription(uint index);
static uint16 _num_nodes;
/**
@@ -70,17 +68,10 @@ const SaveLoad *GetLinkGraphJobDesc()
/* Build the SaveLoad array on first call and don't touch it later on */
if (saveloads.size() == 0) {
size_t prefixlen = strlen(prefix);
GetSettingSaveLoadByPrefix(prefix, saveloads);
int setting = 0;
const SettingDesc *desc = GetSettingDescription(setting);
while (desc != nullptr) {
if (desc->name != nullptr && strncmp(desc->name, prefix, prefixlen) == 0) {
SaveLoad sl = desc->save;
sl.address_proc = proc;
saveloads.push_back(sl);
}
desc = GetSettingDescription(++setting);
for (auto &sl : saveloads) {
sl.address_proc = proc;
}
int i = 0;