From: Soeren Apel Date: Mon, 2 May 2016 16:10:55 +0000 (+0200) Subject: Input/csv: Add reset() function X-Git-Tag: libsigrok-0.5.0~434 X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=ad93bfb0b96d6b58379ff73275701e72e08c63a4 Input/csv: Add reset() function --- diff --git a/src/input/csv.c b/src/input/csv.c index 984a58c7..a8c68944 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -768,6 +768,17 @@ static void cleanup(struct sr_input *in) g_free(inc->sample_buffer); } +static int reset(struct sr_input *in) +{ + struct context *inc = in->priv; + + cleanup(in); + inc->started = FALSE; + g_string_truncate(in->buf, 0); + + return SR_OK; +} + static struct sr_option options[] = { { "single-column", "Single column", "Enable/specify single column", NULL, NULL }, { "numchannels", "Max channels", "Number of channels", NULL, NULL }, @@ -808,4 +819,5 @@ SR_PRIV struct sr_input_module input_csv = { .receive = receive, .end = end, .cleanup = cleanup, + .reset = reset, };