summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-28 13:39:18 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-28 13:39:18 +0200
commit738639cf711c254bcafbb869837a87ea46413c5a (patch)
tree899a6ac9148d30383239af453748c2f8bf919d90 /src
parent81bff2df037a218cb973559a2bfbfbd259b1cbad (diff)
downloadfastd-738639cf711c254bcafbb869837a87ea46413c5a.tar
fastd-738639cf711c254bcafbb869837a87ea46413c5a.zip
Introduce constants for tristate values
Diffstat (limited to 'src')
-rw-r--r--src/config.y4
-rw-r--r--src/types.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/config.y b/src/config.y
index e9ab3af..95ceaa2 100644
--- a/src/config.y
+++ b/src/config.y
@@ -560,8 +560,8 @@ boolean: TOK_YES { $$ = true; }
| TOK_NO { $$ = false; }
;
-autobool: TOK_AUTO { $$ = (fastd_tristate_t){ .set = false }; }
- | boolean { $$ = (fastd_tristate_t){ .set = true, .state = $1 }; }
+autobool: TOK_AUTO { $$ = fastd_tristate_undef; }
+ | boolean { $$ = $1 ? fastd_tristate_true : fastd_tristate_false; }
;
colon_or_port: ':'
diff --git a/src/types.h b/src/types.h
index 2dcfa58..3af287a 100644
--- a/src/types.h
+++ b/src/types.h
@@ -47,6 +47,11 @@ typedef struct fastd_tristate {
bool state : 1;
} fastd_tristate_t;
+static const fastd_tristate_t fastd_tristate_true = {true, true};
+static const fastd_tristate_t fastd_tristate_false = {true, false};
+static const fastd_tristate_t fastd_tristate_undef = {false, false};
+
+
typedef enum fastd_mode {
MODE_TAP,
MODE_TUN,