input: sr_input_free() is now a void function.

Its backend, input_module.cleanup(), is now also a void function.
This commit is contained in:
Bert Vermeulen 2014-09-23 11:27:50 +02:00
parent 7066fd4660
commit d5cc282ff8
5 changed files with 8 additions and 18 deletions

View File

@ -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 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_send(const struct sr_input *in, GString *buf);
SR_API int sr_input_end(const struct sr_input *in); 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 -------------------------------------------------------*/ /*--- output/output.c -------------------------------------------------------*/

View File

@ -758,7 +758,7 @@ static int end(struct sr_input *in)
return ret; return ret;
} }
static int cleanup(struct sr_input *in) static void cleanup(struct sr_input *in)
{ {
struct context *inc; struct context *inc;
@ -775,8 +775,6 @@ static int cleanup(struct sr_input *in)
if (inc->sample_buffer) if (inc->sample_buffer)
g_free(inc->sample_buffer); g_free(inc->sample_buffer);
return SR_OK;
} }
static struct sr_option options[] = { static struct sr_option options[] = {

View File

@ -548,28 +548,22 @@ SR_API int sr_input_end(const struct sr_input *in)
* *
* @since 0.4.0 * @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) if (!in)
return SR_ERR_ARG; return;
ret = SR_OK;
if (in->module->cleanup) if (in->module->cleanup)
ret = in->module->cleanup((struct sr_input *)in); in->module->cleanup((struct sr_input *)in);
if (in->sdi) if (in->sdi)
sr_dev_inst_free(in->sdi); sr_dev_inst_free(in->sdi);
if (in->buf->len > 64) { if (in->buf->len > 64) {
/* That seems more than just some sub-unitsize leftover... */ /* That seems more than just some sub-unitsize leftover... */
sr_warn("Found %d unprocessed bytes at free time.", in->buf->len); 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(in->priv);
g_free((gpointer)in); g_free((gpointer)in);
return ret;
} }

View File

@ -537,14 +537,12 @@ static int end(struct sr_input *in)
return ret; return ret;
} }
static int cleanup(struct sr_input *in) static void cleanup(struct sr_input *in)
{ {
struct context *inc; struct context *inc;
inc = in->priv; inc = in->priv;
g_slist_free_full(inc->channels, free_channel); g_slist_free_full(inc->channels, free_channel);
return SR_OK;
} }
static struct sr_option options[] = { static struct sr_option options[] = {

View File

@ -319,7 +319,7 @@ struct sr_input_module {
* @retval SR_OK Success * @retval SR_OK Success
* @retval other Negative error code. * @retval other Negative error code.
*/ */
int (*cleanup) (struct sr_input *in); void (*cleanup) (struct sr_input *in);
}; };
/** Output module instance. */ /** Output module instance. */