diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-07-31 17:37:55 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-07-31 17:37:55 -0300 |
commit | 300d834e9151637962d36df1ba650fbf1666c722 (patch) | |
tree | afdc42757aab0b24c58d1af870725f600a854172 /misc.c | |
parent | 85d46c79c53ea73d76e5146523c09603788bcb2a (diff) |
misc: Make sure that `s` starts at the character before the delimiter in
`find_delm()`
Also `s` doesn't get incremented when checking if the current character
is a backslash now.
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -72,9 +72,9 @@ char *get_line(char **str) { char *find_delm(char *str, const char *delm, int skip_delm) { if (!is_empty(str)) { char *s; - for (s = str; *s != '\0'; s += strcspn(s, delm)) { - if (*s++ == '\\') { - s += strspn(s, delm); + for (s = &str[strcspn(str, delm)]; *s != '\0'; s += strcspn(s, delm)) { + if (*s == '\\') { + s += strspn(++s, delm); continue; } else { break; |