From 2e2c8bff3507ac55d772cde3a7eced8f03efdba3 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Sat, 10 Jul 2021 15:45:51 -0400 Subject: [PATCH] input: reset after parse --- input.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/input.c b/input.c index 0845a04..550292a 100644 --- a/input.c +++ b/input.c @@ -10,6 +10,7 @@ void libscomm_reset(struct libscomm_input *in) { static enum libscomm_input_r parse(struct libscomm_input *in, struct libscomm_line *line) { char *s = in->intbuf; + enum libscomm_input_r r = LIBSCOMM_ARG_OVERFLOW; line->name = (*s == ':'); line->len = 0; @@ -19,14 +20,16 @@ static enum libscomm_input_r parse(struct libscomm_input *in, for (; *s && *s != '\t'; s++); if (!*s) { - return LIBSCOMM_COMPLETE; + r = LIBSCOMM_COMPLETE; + break; } else { *s = 0; s++; } } - return LIBSCOMM_ARG_OVERFLOW; + libscomm_reset(in); + return r; } enum libscomm_input_r libscomm_read(struct libscomm_input *in,