From: Bert Vermeulen Date: Mon, 18 Aug 2014 21:54:46 +0000 (+0200) Subject: output: Fix output option enumeration. X-Git-Tag: libsigrok-0.4.0~1138 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=499c85dce538b5bb270bce62ba6c6911254f58a4;p=libsigrok.git output: Fix output option enumeration. --- diff --git a/src/output/output.c b/src/output/output.c index a96fab2b..787d75c7 100644 --- a/src/output/output.c +++ b/src/output/output.c @@ -187,25 +187,25 @@ SR_API const struct sr_option **sr_output_options_get(const struct sr_output_mod * * @since 0.4.0 */ -SR_API void sr_output_options_free(const struct sr_option **opts) +SR_API void sr_output_options_free(const struct sr_option **options) { - struct sr_option *opt; + int i; - if (!opts) + if (!options) return; - for (opt = (struct sr_option *)opts[0]; opt; opt++) { - if (opt->def) { - g_variant_unref(opt->def); - opt->def = NULL; + for (i = 0; options[i]; i++) { + if (options[i]->def) { + g_variant_unref(options[i]->def); + ((struct sr_option *)options[i])->def = NULL; } - if (opt->values) { - g_slist_free_full(opt->values, (GDestroyNotify)g_variant_unref); - opt->values = NULL; + if (options[i]->values) { + g_slist_free_full(options[i]->values, (GDestroyNotify)g_variant_unref); + ((struct sr_option *)options[i])->values = NULL; } } - g_free(opts); + g_free(options); } /**