From: Bert Vermeulen Date: Fri, 15 Aug 2014 18:21:50 +0000 (+0200) Subject: output: Constify module options. X-Git-Tag: libsigrok-0.4.0~1147 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=af7d656d37de4b8b7fc344fd557f9ae8d3238705;p=libsigrok.git output: Constify module options. --- diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 63fcff91..fea409f0 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -205,11 +205,8 @@ struct sr_output_module { /** * Returns a NULL-terminated list of options this module can take. * Can be NULL, if the module has no options. - * - * If cached is TRUE, no new GVariants are created for the def and - * values fields; instead, the current values are returned. */ - struct sr_option *(*options) (void); + const struct sr_option *(*options) (void); /** * This function is called once, at the beginning of an output stream. diff --git a/src/output/ascii.c b/src/output/ascii.c index 562d0255..9f69d007 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -238,7 +238,7 @@ static struct sr_option options[] = { { 0 } }; -static struct sr_option *get_options(void) +static const struct sr_option *get_options(void) { if (!options[0].def) { options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE); diff --git a/src/output/bits.c b/src/output/bits.c index 728ff2ff..6b33f8d6 100644 --- a/src/output/bits.c +++ b/src/output/bits.c @@ -224,7 +224,7 @@ static struct sr_option options[] = { { 0 } }; -static struct sr_option *get_options(void) +static const struct sr_option *get_options(void) { if (!options[0].def) { options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE); diff --git a/src/output/hex.c b/src/output/hex.c index 1d419638..6c0e15d5 100644 --- a/src/output/hex.c +++ b/src/output/hex.c @@ -238,7 +238,7 @@ static struct sr_option options[] = { { 0 } }; -static struct sr_option *get_options(void) +static const struct sr_option *get_options(void) { if (!options[0].def) { options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE); diff --git a/src/output/output.c b/src/output/output.c index 0dd1fe27..a96fab2b 100644 --- a/src/output/output.c +++ b/src/output/output.c @@ -225,7 +225,7 @@ SR_API const struct sr_output *sr_output_new(const struct sr_output_module *o, GHashTable *options, const struct sr_dev_inst *sdi) { struct sr_output *op; - struct sr_option *mod_opts; + const struct sr_option *mod_opts; const GVariantType *gvt; GHashTable *new_opts; GHashTableIter iter; diff --git a/src/output/wav.c b/src/output/wav.c index 679bee68..9dc5a110 100644 --- a/src/output/wav.c +++ b/src/output/wav.c @@ -339,7 +339,7 @@ static struct sr_option options[] = { { 0 } }; -static struct sr_option *get_options(void) +static const struct sr_option *get_options(void) { if (!options[0].def) options[0].def = g_variant_ref_sink(g_variant_new_double(0.0));