From: Bert Vermeulen Date: Tue, 23 Sep 2014 09:27:50 +0000 (+0200) Subject: input: sr_input_free() is now a void function. X-Git-Tag: libsigrok-0.4.0~918 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d5cc282ff8026173c14ff6957482a24b2d6feef3;p=libsigrok.git input: sr_input_free() is now a void function. Its backend, input_module.cleanup(), is now also a void function. --- diff --git a/include/libsigrok/proto.h b/include/libsigrok/proto.h index d75e0237..3c693642 100644 --- a/include/libsigrok/proto.h +++ b/include/libsigrok/proto.h @@ -138,7 +138,7 @@ SR_API int sr_input_scan_file(const char *filename, const struct sr_input **in); SR_API struct sr_dev_inst *sr_input_dev_inst_get(const struct sr_input *in); SR_API int sr_input_send(const struct sr_input *in, GString *buf); SR_API int sr_input_end(const struct sr_input *in); -SR_API int sr_input_free(const struct sr_input *in); +SR_API void sr_input_free(const struct sr_input *in); /*--- output/output.c -------------------------------------------------------*/ diff --git a/src/input/csv.c b/src/input/csv.c index 9af17be0..e72357bb 100644 --- a/src/input/csv.c +++ b/src/input/csv.c @@ -758,7 +758,7 @@ static int end(struct sr_input *in) return ret; } -static int cleanup(struct sr_input *in) +static void cleanup(struct sr_input *in) { struct context *inc; @@ -775,8 +775,6 @@ static int cleanup(struct sr_input *in) if (inc->sample_buffer) g_free(inc->sample_buffer); - - return SR_OK; } static struct sr_option options[] = { diff --git a/src/input/input.c b/src/input/input.c index 43b49d3f..3547d9e1 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -548,28 +548,22 @@ SR_API int sr_input_end(const struct sr_input *in) * * @since 0.4.0 */ -SR_API int sr_input_free(const struct sr_input *in) +SR_API void sr_input_free(const struct sr_input *in) { - int ret; - if (!in) - return SR_ERR_ARG; + return; - ret = SR_OK; if (in->module->cleanup) - ret = in->module->cleanup((struct sr_input *)in); + in->module->cleanup((struct sr_input *)in); if (in->sdi) sr_dev_inst_free(in->sdi); if (in->buf->len > 64) { /* That seems more than just some sub-unitsize leftover... */ sr_warn("Found %d unprocessed bytes at free time.", in->buf->len); } - if (in->buf) - g_string_free(in->buf, TRUE); + g_string_free(in->buf, TRUE); g_free(in->priv); g_free((gpointer)in); - - return ret; } diff --git a/src/input/vcd.c b/src/input/vcd.c index 96bd6335..ef78c9fe 100644 --- a/src/input/vcd.c +++ b/src/input/vcd.c @@ -537,14 +537,12 @@ static int end(struct sr_input *in) return ret; } -static int cleanup(struct sr_input *in) +static void cleanup(struct sr_input *in) { struct context *inc; inc = in->priv; g_slist_free_full(inc->channels, free_channel); - - return SR_OK; } static struct sr_option options[] = { diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 27f0a615..faac4647 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -319,7 +319,7 @@ struct sr_input_module { * @retval SR_OK Success * @retval other Negative error code. */ - int (*cleanup) (struct sr_input *in); + void (*cleanup) (struct sr_input *in); }; /** Output module instance. */