After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 650345 - g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError se...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-05-16 19:31 UTC by Colin Walters
Modified: 2011-07-22 14:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics (2.22 KB, patch)
2011-05-16 19:31 UTC, Colin Walters
none Details | Review
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics (4.52 KB, patch)
2011-05-16 19:37 UTC, Colin Walters
reviewed Details | Review
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics (5.56 KB, patch)
2011-05-17 20:15 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2011-05-16 19:31:52 UTC
See https://bugzilla.gnome.org/show_bug.cgi?id=649657 for discussion
of why it's bad for bindings for gerror return values to both signal
errors and carry meaning.
Comment 1 Colin Walters 2011-05-16 19:31:54 UTC
Created attachment 187927 [details] [review]
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics
Comment 2 Colin Walters 2011-05-16 19:37:51 UTC
Created attachment 187928 [details] [review]
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics

Now with tests and a header entry
Comment 3 Matthias Clasen 2011-05-17 03:37:36 UTC
Review of attachment 187928 [details] [review]:

Can we make g_key_file_has_key() just a wrapper around this one ?
Comment 4 Matthias Clasen 2011-05-17 03:37:58 UTC
Review of attachment 187928 [details] [review]:

set patch status
Comment 5 Matthias Clasen 2011-05-17 03:37:58 UTC
Review of attachment 187928 [details] [review]:

set patch status
Comment 6 Colin Walters 2011-05-17 20:15:44 UTC
Created attachment 187989 [details] [review]
g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics

Rebase g_key_file_has_key on g_key_file_has_key_full() per mclasen's
comment, and add more docs.
Comment 7 Matthias Clasen 2011-05-18 00:51:58 UTC
Review of attachment 187989 [details] [review]:

Other than that, looks good to me.

::: glib/gkeyfile.c
@@ +3154,3 @@
+ * @group_name.
+ *
+ * Return value: %TRUE if @group_name exists, %FALSE otherwise

I think the return value docs could be clearer and say something like:

Return value: %TRUE if a group with the name @group_name exists. Otherwise, @error is set and %FALSE is returned.
Comment 8 Colin Walters 2011-05-18 15:53:36 UTC
Attachment 187989 [details] pushed as 9966fe4 - g_key_file_has_key_full: New function to fix g_key_file_has_key()'s GError semantics
Comment 9 Colin Walters 2011-07-22 14:59:11 UTC
commit 8b061e023ce97171d817e07ea7068f567129ae8a
Author: Colin Walters <walters@verbum.org>
Date:   Fri Jul 22 10:31:27 2011 -0400

    Revert addition of g_key_file_has_key_full
    
    Per IRC discussion, we can just ask bindings to use
    g_key_file_get_value() to test for the existence of a key.
    
    I left the "fixed" code in the source tree as static because it makes
    more sense to me.