mirror of
https://github.com/swaywm/sway.git
synced 2025-11-06 13:29:50 -05:00
enhanced whitespace remover
This commit is contained in:
parent
e9c3a9016f
commit
abd0afb03a
4 changed files with 32 additions and 33 deletions
|
|
@ -490,7 +490,7 @@ static char **split_directive(char *line, int *argc) {
|
|||
if (!*line) return parts;
|
||||
|
||||
int in_string = 0, in_character = 0;
|
||||
int i, j, _;
|
||||
int i, j;
|
||||
for (i = 0, j = 0; line[i]; ++i) {
|
||||
if (line[i] == '\\') {
|
||||
++i;
|
||||
|
|
@ -503,7 +503,7 @@ static char **split_directive(char *line, int *argc) {
|
|||
char *item = malloc(i - j + 1);
|
||||
strncpy(item, line + j, i - j);
|
||||
item[i - j] = '\0';
|
||||
item = strip_whitespace(item, &_);
|
||||
strip_whitespace(item);
|
||||
if (item[0] == '\0') {
|
||||
free(item);
|
||||
} else {
|
||||
|
|
@ -521,7 +521,7 @@ static char **split_directive(char *line, int *argc) {
|
|||
char *item = malloc(i - j + 1);
|
||||
strncpy(item, line + j, i - j);
|
||||
item[i - j] = '\0';
|
||||
item = strip_whitespace(item, &_);
|
||||
strip_whitespace(item);
|
||||
if (*argc == capacity) {
|
||||
capacity++;
|
||||
parts = realloc(parts, sizeof(char *) * capacity);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue