From b865dabebab717fea75f91e8ccebabc99e36bdd9 Mon Sep 17 00:00:00 2001 From: Connor E <38229097+c-edw@users.noreply.github.com> Date: Sat, 10 Nov 2018 12:55:06 +0000 Subject: Use parse_boolean where possible. --- sway/commands/smart_gaps.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'sway/commands/smart_gaps.c') diff --git a/sway/commands/smart_gaps.c b/sway/commands/smart_gaps.c index 273905df..f14b6760 100644 --- a/sway/commands/smart_gaps.c +++ b/sway/commands/smart_gaps.c @@ -6,6 +6,7 @@ #include "sway/tree/container.h" #include "log.h" #include "stringop.h" +#include "util.h" struct cmd_results *cmd_smart_gaps(int argc, char **argv) { struct cmd_results *error = checkarg(argc, "smart_gaps", EXPECTED_AT_LEAST, 1); @@ -14,14 +15,7 @@ struct cmd_results *cmd_smart_gaps(int argc, char **argv) { return error; } - if (strcmp(argv[0], "on") == 0) { - config->smart_gaps = true; - } else if (strcmp(argv[0], "off") == 0) { - config->smart_gaps = false; - } else { - return cmd_results_new(CMD_INVALID, "smart_gaps", - "Expected 'smart_gaps ' "); - } + config->smart_gaps = parse_boolean(argv[0], config->smart_gaps); arrange_root(); -- cgit v1.2.3-54-g00ecf