From 34e9a0a96063889b6298cdd7650106b57212458e Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Fri, 19 Jun 2009 07:02:13 +0200
Subject: conf: replace "mask" bit field with two "bool" variables

Due to padding, this takes the same amount of memory.
---
 src/conf.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

(limited to 'src/conf.c')

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);
-- 
cgit v1.2.3