summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-10-13 07:41:56 +0200
committerTyge Løvset <[email protected]>2020-10-13 07:41:56 +0200
commit88605737db66987689349abf9d685f0acb6653c4 (patch)
treef2f6c5cd63a9b3828893d74e044fb62785f66bba
parent10bd8ec8e6daf98b86df0e6de176cd1bc98caecb (diff)
downloadSTC-modified-88605737db66987689349abf9d685f0acb6653c4.tar.gz
STC-modified-88605737db66987689349abf9d685f0acb6653c4.zip
Fixed cstr_getdelim()
-rw-r--r--stc/cstr.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/stc/cstr.h b/stc/cstr.h
index 2bee77f5..7031cc63 100644
--- a/stc/cstr.h
+++ b/stc/cstr.h
@@ -339,8 +339,8 @@ cstr_getdelim(cstr_t *self, int delim, FILE *stream) {
do {
*cur++ = (char) c;
if (c == delim || (c = fgetc(stream)) == EOF) {
- *cur = '\0';
- _cstr_size(*self) = pos + 1;
+ pos += c != delim;
+ self->str[_cstr_size(*self) = pos] = '\0';
return errno == 0;
}
} while (++pos != cap - 1);