aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/util.c')
-rw-r--r--common/util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/util.c b/common/util.c
index 199f3ee1..7c492bcb 100644
--- a/common/util.c
+++ b/common/util.c
@@ -1,4 +1,3 @@
1#define _POSIX_C_SOURCE 200809L
2#include <ctype.h> 1#include <ctype.h>
3#include <fcntl.h> 2#include <fcntl.h>
4#include <math.h> 3#include <math.h>
@@ -80,6 +79,12 @@ enum movement_unit parse_movement_unit(const char *unit) {
80 79
81int parse_movement_amount(int argc, char **argv, 80int parse_movement_amount(int argc, char **argv,
82 struct movement_amount *amount) { 81 struct movement_amount *amount) {
82 if (!sway_assert(argc > 0, "Expected args in parse_movement_amount")) {
83 amount->amount = 0;
84 amount->unit = MOVEMENT_UNIT_INVALID;
85 return 0;
86 }
87
83 char *err; 88 char *err;
84 amount->amount = (int)strtol(argv[0], &err, 10); 89 amount->amount = (int)strtol(argv[0], &err, 10);
85 if (*err) { 90 if (*err) {