diff options
author | Philip Withnall <withnall@endlessm.com> | 2018-05-04 10:13:13 +0100 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2018-05-04 18:17:59 +0100 |
commit | cc4de801c9643b62c5566d4d9dc3439ca801a4e6 (patch) | |
tree | 7b87ea3f45146bf47ac478e924818bfcbc6431d0 /gobject/gparamspecs.h | |
parent | a06117d0623ec0ddef895db605bac09460daae15 (diff) | |
download | glib-cc4de801c9643b62c5566d4d9dc3439ca801a4e6.tar.gz |
gobject: Reimplement g_param_values_cmp() for GParamSpecVariant
The existing implementation was completely incorrect (despite the fix in
commit 566e64a66) — it always compared GVariants by pointer, rather than
by value.
Reimplement it to compare them by value where possible, depending on
their type. The core of this implementation is g_variant_compare(). See
the documentation and tests for further details of the new sort order.
This adds documentation and tests.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=795735
Diffstat (limited to 'gobject/gparamspecs.h')
-rw-r--r-- | gobject/gparamspecs.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h index e2bb62130..26045a368 100644 --- a/gobject/gparamspecs.h +++ b/gobject/gparamspecs.h @@ -962,6 +962,12 @@ struct _GParamSpecGType * * A #GParamSpec derived structure that contains the meta data for #GVariant properties. * + * When comparing values with g_param_values_cmp(), scalar values with the same + * type will be compared with g_variant_compare(). Other non-%NULL variants will + * be checked for equality with g_variant_equal(), and their sort order is + * otherwise undefined. %NULL is ordered before non-%NULL variants. Two %NULL + * values compare equal. + * * Since: 2.26 */ struct _GParamSpecVariant |