aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-06-19 07:02:13 +0200
committerMax Kellermann <max@duempel.org>2009-06-25 08:38:51 +0200
commit34e9a0a96063889b6298cdd7650106b57212458e (patch)
tree1dfaac3a67ffae25720bb9f0bfde459d8cd357d2 /src/conf.c
parentb1e95b1fa8bd2bfdef34b113b1474666618f75b8 (diff)
downloadmpd-34e9a0a96063889b6298cdd7650106b57212458e.tar.gz
mpd-34e9a0a96063889b6298cdd7650106b57212458e.tar.xz
mpd-34e9a0a96063889b6298cdd7650106b57212458e.zip
conf: replace "mask" bit field with two "bool" variables
Due to padding, this takes the same amount of memory.
Diffstat (limited to 'src/conf.c')
-rw-r--r--src/conf.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/conf.c b/src/conf.c
index 4a5e4c836..337c2b549 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -39,13 +39,12 @@
#define CONF_BLOCK_BEGIN "{"
#define CONF_BLOCK_END "}"
-#define CONF_REPEATABLE_MASK 0x01
-#define CONF_BLOCK_MASK 0x02
#define CONF_LINE_TOKEN_MAX 3
struct config_entry {
const char *name;
- unsigned char mask;
+ bool repeatable;
+ bool block;
GSList *params;
};
@@ -111,14 +110,10 @@ newConfigEntry(const char *name, int repeatable, int block)
struct config_entry *ret = g_new(struct config_entry, 1);
ret->name = name;
- ret->mask = 0;
+ ret->repeatable = repeatable;
+ ret->block = block;
ret->params = NULL;
- if (repeatable)
- ret->mask |= CONF_REPEATABLE_MASK;
- if (block)
- ret->mask |= CONF_BLOCK_MASK;
-
return ret;
}
@@ -334,15 +329,14 @@ void config_read_file(const char *file)
g_error("unrecognized parameter in config file at "
"line %i: %s\n", count, string);
- if (!(entry->mask & CONF_REPEATABLE_MASK) &&
- entry->params != NULL) {
+ if (entry->params != NULL && !entry->repeatable) {
param = entry->params->data;
g_error("config parameter \"%s\" is first defined on "
"line %i and redefined on line %i\n",
array[0], param->line, count);
}
- if (entry->mask & CONF_BLOCK_MASK) {
+ if (entry->block) {
if (0 != strcmp(array[1], CONF_BLOCK_BEGIN)) {
g_error("improperly formatted config file at "
"line %i: %s\n", count, string);