Constify g_param_value_defaults() argument

The GValue we pass in is supposed to not be modified by the GParamSpec.
This commit is contained in:
Emmanuele Bassi 2019-10-26 14:03:16 +01:00
parent 47d558baa7
commit 6ad799ac67
2 changed files with 3 additions and 4 deletions

View File

@ -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);

View File

@ -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);