From bd35879e1cfda51accc68c9890980dce59eb006a Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Tue, 1 Jan 2019 09:01:09 +0000 Subject: [PATCH] fixup! config.c: re-enable backslash continuation in config file --- sway/config.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sway/config.c b/sway/config.c index 4177ea10..9f32d44c 100644 --- a/sway/config.c +++ b/sway/config.c @@ -574,11 +574,7 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file) char *next_line = NULL; size_t next_line_size = 0; ssize_t nread = getline(lineptr, line_size, file); - while (nread >= 2) { - if (strcmp(&(*lineptr)[nread - 2], "\\\n") != 0) { - break; - } - + while (nread >= 2 && strcmp(&(*lineptr)[nread - 2], "\\\n") == 0) { ssize_t next_nread = getline(&next_line, &next_line_size, file); if (next_nread == -1) { break; @@ -588,7 +584,7 @@ static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file) if ((ssize_t) *line_size < nread + 1) { *line_size = nread + 1; *lineptr = realloc(*lineptr, *line_size); - if (!lineptr) { + if (!*lineptr) { nread = -1; break; }