output: Constify module options.

This commit is contained in:
Bert Vermeulen 2014-08-15 20:21:50 +02:00
parent fc74643098
commit af7d656d37
6 changed files with 6 additions and 9 deletions

View File

@ -205,11 +205,8 @@ struct sr_output_module {
/** /**
* Returns a NULL-terminated list of options this module can take. * Returns a NULL-terminated list of options this module can take.
* Can be NULL, if the module has no options. * 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. * This function is called once, at the beginning of an output stream.

View File

@ -238,7 +238,7 @@ static struct sr_option options[] = {
{ 0 } { 0 }
}; };
static struct sr_option *get_options(void) static const struct sr_option *get_options(void)
{ {
if (!options[0].def) { if (!options[0].def) {
options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE); options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);

View File

@ -224,7 +224,7 @@ static struct sr_option options[] = {
{ 0 } { 0 }
}; };
static struct sr_option *get_options(void) static const struct sr_option *get_options(void)
{ {
if (!options[0].def) { if (!options[0].def) {
options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE); options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);

View File

@ -238,7 +238,7 @@ static struct sr_option options[] = {
{ 0 } { 0 }
}; };
static struct sr_option *get_options(void) static const struct sr_option *get_options(void)
{ {
if (!options[0].def) { if (!options[0].def) {
options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE); options[0].def = g_variant_new_uint32(DEFAULT_SAMPLES_PER_LINE);

View File

@ -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) GHashTable *options, const struct sr_dev_inst *sdi)
{ {
struct sr_output *op; struct sr_output *op;
struct sr_option *mod_opts; const struct sr_option *mod_opts;
const GVariantType *gvt; const GVariantType *gvt;
GHashTable *new_opts; GHashTable *new_opts;
GHashTableIter iter; GHashTableIter iter;

View File

@ -339,7 +339,7 @@ static struct sr_option options[] = {
{ 0 } { 0 }
}; };
static struct sr_option *get_options(void) static const struct sr_option *get_options(void)
{ {
if (!options[0].def) if (!options[0].def)
options[0].def = g_variant_ref_sink(g_variant_new_double(0.0)); options[0].def = g_variant_ref_sink(g_variant_new_double(0.0));