aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2018-12-09 11:52:55 +0000
committerLibravatar Ian Fan <ianfan0@gmail.com>2019-01-01 09:01:24 +0000
commit967566e37f93890bd5255725129c929aeeac709e (patch)
tree7d6bc1470609b2c0da92889db36833cc2e5e8431 /sway
parentbash: add completion for swaybar (diff)
downloadsway-967566e37f93890bd5255725129c929aeeac709e.tar.gz
sway-967566e37f93890bd5255725129c929aeeac709e.tar.zst
sway-967566e37f93890bd5255725129c929aeeac709e.zip
stringop.c: rewrite strip_whitespace
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c6
-rw-r--r--sway/config.c4
-rw-r--r--sway/input/input-manager.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 927434bc..cd595b03 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -236,15 +236,15 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
236 criteria_destroy(criteria); 236 criteria_destroy(criteria);
237 config->handler_context.using_criteria = true; 237 config->handler_context.using_criteria = true;
238 // Skip leading whitespace 238 // Skip leading whitespace
239 head += strspn(head, whitespace); 239 for (; isspace(*head); ++head) {}
240 } 240 }
241 // Split command list 241 // Split command list
242 cmdlist = argsep(&head, ";"); 242 cmdlist = argsep(&head, ";");
243 cmdlist += strspn(cmdlist, whitespace); 243 for (; isspace(*cmdlist); ++cmdlist) {}
244 do { 244 do {
245 // Split commands 245 // Split commands
246 cmd = argsep(&cmdlist, ","); 246 cmd = argsep(&cmdlist, ",");
247 cmd += strspn(cmd, whitespace); 247 for (; isspace(*cmd); ++cmd) {}
248 if (strcmp(cmd, "") == 0) { 248 if (strcmp(cmd, "") == 0) {
249 wlr_log(WLR_INFO, "Ignoring empty command."); 249 wlr_log(WLR_INFO, "Ignoring empty command.");
250 continue; 250 continue;
diff --git a/sway/config.c b/sway/config.c
index bb7f796d..c71f315a 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -580,7 +580,7 @@ static int detect_brace_on_following_line(FILE *file, char *line,
580 free(peeked); 580 free(peeked);
581 peeked = peek_line(file, lines, &position); 581 peeked = peek_line(file, lines, &position);
582 if (peeked) { 582 if (peeked) {
583 peeked = strip_whitespace(peeked); 583 strip_whitespace(peeked);
584 } 584 }
585 lines++; 585 lines++;
586 } while (peeked && strlen(peeked) == 0); 586 } while (peeked && strlen(peeked) == 0);
@@ -663,7 +663,7 @@ bool read_config(FILE *file, struct sway_config *config,
663 read += length + 1; 663 read += length + 1;
664 } 664 }
665 665
666 line = strip_whitespace(line); 666 strip_whitespace(line);
667 if (line[0] == '#') { 667 if (line[0] == '#') {
668 free(line); 668 free(line);
669 continue; 669 continue;
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index 61087733..04e14355 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -49,7 +49,7 @@ char *input_device_get_identifier(struct wlr_input_device *device) {
49 int vendor = device->vendor; 49 int vendor = device->vendor;
50 int product = device->product; 50 int product = device->product;
51 char *name = strdup(device->name); 51 char *name = strdup(device->name);
52 name = strip_whitespace(name); 52 strip_whitespace(name);
53 53
54 char *p = name; 54 char *p = name;
55 for (; *p; ++p) { 55 for (; *p; ++p) {