shared/conf-parser: turn CONFIG_PARSE_REFUSE_BOM flag into a local variable
This is an internal implementation detail.
This commit is contained in:
parent
bdf2357c12
commit
f9761a89a8
|
@ -282,7 +282,7 @@ int config_parse(const char *unit,
|
|||
_cleanup_free_ char *section = NULL, *continuation = NULL;
|
||||
_cleanup_fclose_ FILE *ours = NULL;
|
||||
unsigned line = 0, section_line = 0;
|
||||
bool section_ignored = false;
|
||||
bool section_ignored = false, bom_seen = false;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
|
@ -328,13 +328,13 @@ int config_parse(const char *unit,
|
|||
continue;
|
||||
|
||||
l = buf;
|
||||
if (!(flags & CONFIG_PARSE_REFUSE_BOM)) {
|
||||
if (!bom_seen) {
|
||||
char *q;
|
||||
|
||||
q = startswith(buf, UTF8_BYTE_ORDER_MARK);
|
||||
if (q) {
|
||||
l = q;
|
||||
flags |= CONFIG_PARSE_REFUSE_BOM;
|
||||
bom_seen = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ typedef enum ConfigParseFlags {
|
|||
CONFIG_PARSE_RELAXED = 1 << 0,
|
||||
CONFIG_PARSE_ALLOW_INCLUDE = 1 << 1,
|
||||
CONFIG_PARSE_WARN = 1 << 2,
|
||||
CONFIG_PARSE_REFUSE_BOM = 1 << 3,
|
||||
} ConfigParseFlags;
|
||||
|
||||
/* Argument list for parsers of specific configuration settings. */
|
||||
|
|
Loading…
Reference in New Issue