tag/Config: use SplitString()
This commit is contained in:
parent
4208fe29b5
commit
0f19108ce3
|
@ -23,12 +23,9 @@
|
||||||
#include "ParseName.hxx"
|
#include "ParseName.hxx"
|
||||||
#include "config/Data.hxx"
|
#include "config/Data.hxx"
|
||||||
#include "config/Option.hxx"
|
#include "config/Option.hxx"
|
||||||
#include "util/Alloc.hxx"
|
|
||||||
#include "util/ASCII.hxx"
|
#include "util/ASCII.hxx"
|
||||||
#include "util/StringStrip.hxx"
|
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
#include "util/SplitString.hxx"
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TagLoadConfig(const ConfigData &config)
|
TagLoadConfig(const ConfigData &config)
|
||||||
|
@ -42,31 +39,14 @@ TagLoadConfig(const ConfigData &config)
|
||||||
if (StringEqualsCaseASCII(value, "none"))
|
if (StringEqualsCaseASCII(value, "none"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool quit = false;
|
for (const auto &i : SplitString(value, ',')) {
|
||||||
char *temp, *c, *s;
|
const char *name = i.c_str();
|
||||||
temp = c = s = xstrdup(value);
|
|
||||||
do {
|
|
||||||
if (*s == ',' || *s == '\0') {
|
|
||||||
if (*s == '\0')
|
|
||||||
quit = true;
|
|
||||||
*s = '\0';
|
|
||||||
|
|
||||||
c = Strip(c);
|
const auto type = tag_name_parse_i(name);
|
||||||
if (*c == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const auto type = tag_name_parse_i(c);
|
|
||||||
if (type == TAG_NUM_OF_ITEM_TYPES)
|
if (type == TAG_NUM_OF_ITEM_TYPES)
|
||||||
throw FormatRuntimeError("error parsing metadata item \"%s\"",
|
throw FormatRuntimeError("error parsing metadata item \"%s\"",
|
||||||
c);
|
name);
|
||||||
|
|
||||||
global_tag_mask |= type;
|
global_tag_mask |= type;
|
||||||
|
|
||||||
s++;
|
|
||||||
c = s;
|
|
||||||
}
|
}
|
||||||
s++;
|
|
||||||
} while (!quit);
|
|
||||||
|
|
||||||
free(temp);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue