diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-10-26 14:03:16 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2019-10-26 14:03:16 +0100 |
commit | 6ad799ac677ae241da8b32ecf33b5cc9dc1d30bc (patch) | |
tree | 7dd480522e78bf6bee8983a80e3f1ef1dbecb364 | |
parent | 47d558baa7d77093d22af27789a0caf3e0d17332 (diff) | |
download | glib-6ad799ac677ae241da8b32ecf33b5cc9dc1d30bc.tar.gz |
Constify g_param_value_defaults() argument
The GValue we pass in is supposed to not be modified by the GParamSpec.
-rw-r--r-- | gobject/gparam.c | 5 | ||||
-rw-r--r-- | gobject/gparam.h | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/gobject/gparam.c b/gobject/gparam.c index 17df8316b..1158cddb7 100644 --- a/gobject/gparam.c +++ b/gobject/gparam.c @@ -630,8 +630,8 @@ g_param_value_set_default (GParamSpec *pspec, * Returns: whether @value contains the canonical default for this @pspec */ gboolean -g_param_value_defaults (GParamSpec *pspec, - GValue *value) +g_param_value_defaults (GParamSpec *pspec, + const GValue *value) { GValue dflt_value = G_VALUE_INIT; gboolean defaults; @@ -640,7 +640,6 @@ g_param_value_defaults (GParamSpec *pspec, g_return_val_if_fail (G_IS_VALUE (value), FALSE); g_return_val_if_fail (PSPEC_APPLIES_TO_VALUE (pspec, value), FALSE); - g_value_init (&dflt_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_PARAM_SPEC_GET_CLASS (pspec)->value_set_default (pspec, &dflt_value); defaults = G_PARAM_SPEC_GET_CLASS (pspec)->values_cmp (pspec, value, &dflt_value) == 0; g_value_unset (&dflt_value); diff --git a/gobject/gparam.h b/gobject/gparam.h index 33f95f0c5..b6a554653 100644 --- a/gobject/gparam.h +++ b/gobject/gparam.h @@ -307,7 +307,7 @@ void g_param_value_set_default (GParamSpec *pspec, GValue *value); GLIB_AVAILABLE_IN_ALL gboolean g_param_value_defaults (GParamSpec *pspec, - GValue *value); + const GValue *value); GLIB_AVAILABLE_IN_ALL gboolean g_param_value_validate (GParamSpec *pspec, GValue *value); |