From a612aad7fcf817d6174505e8ac519e6a554d15d3 Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Tue, 21 Sep 2010 21:57:16 +0200 Subject: Return the refernced objects in _ref Both gconf_entry_ref() and gconf_change_set_ref() don't return the referenced objects but nothing (void), which causes issues for g_boxed_copy which uses the return value. https://bugzilla.gnome.org/show_bug.cgi?id=629984 --- doc/gconf/tmpl/gconf-changeset.sgml | 1 + doc/gconf/tmpl/gconf-value.sgml | 1 + gconf/gconf-changeset.c | 4 +++- gconf/gconf-changeset.h | 2 +- gconf/gconf-value.c | 4 +++- gconf/gconf-value.h | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/gconf/tmpl/gconf-changeset.sgml b/doc/gconf/tmpl/gconf-changeset.sgml index af33f9a5..ff8b4339 100644 --- a/doc/gconf/tmpl/gconf-changeset.sgml +++ b/doc/gconf/tmpl/gconf-changeset.sgml @@ -136,6 +136,7 @@ Increases the reference count of a #GConfChangeSet by one. @cs: a #GConfChangeSet. +@Returns: the referenced #GConfChangeSet. diff --git a/doc/gconf/tmpl/gconf-value.sgml b/doc/gconf/tmpl/gconf-value.sgml index 91d67983..4a60684f 100644 --- a/doc/gconf/tmpl/gconf-value.sgml +++ b/doc/gconf/tmpl/gconf-value.sgml @@ -599,6 +599,7 @@ Increases the refcount of a #GConfEntry by one. @entry: a #GConfEntry. +@Returns: the referenced #GConfEntry. diff --git a/gconf/gconf-changeset.c b/gconf/gconf-changeset.c index 4890fce7..e27f1df7 100644 --- a/gconf/gconf-changeset.c +++ b/gconf/gconf-changeset.c @@ -77,12 +77,14 @@ gconf_change_set_new (void) return cs; } -void +GConfChangeSet* gconf_change_set_ref (GConfChangeSet* cs) { g_return_if_fail(cs != NULL); cs->refcount += 1; + + return cs; } void diff --git a/gconf/gconf-changeset.h b/gconf/gconf-changeset.h index 33f2a8a9..b6f1dba1 100644 --- a/gconf/gconf-changeset.h +++ b/gconf/gconf-changeset.h @@ -70,7 +70,7 @@ GConfChangeSet* gconf_engine_change_set_from_current (GConfEngine* conf, GType gconf_change_set_get_type (void); GConfChangeSet* gconf_change_set_new (void); -void gconf_change_set_ref (GConfChangeSet* cs); +GConfChangeSet* gconf_change_set_ref (GConfChangeSet* cs); void gconf_change_set_unref (GConfChangeSet* cs); diff --git a/gconf/gconf-value.c b/gconf/gconf-value.c index da9d7435..de42f752 100644 --- a/gconf/gconf-value.c +++ b/gconf/gconf-value.c @@ -1501,12 +1501,14 @@ gconf_entry_new_nocopy (char* key, GConfValue* val) return (GConfEntry*) real; } -void +GConfEntry * gconf_entry_ref (GConfEntry *entry) { g_return_if_fail (entry != NULL); REAL_ENTRY (entry)->refcount += 1; + + return entry; } void diff --git a/gconf/gconf-value.h b/gconf/gconf-value.h index d8d3c82e..5b37b841 100644 --- a/gconf/gconf-value.h +++ b/gconf/gconf-value.h @@ -186,7 +186,7 @@ GConfEntry* gconf_entry_copy (const GConfEntry *src); #ifndef GCONF_DISABLE_DEPRECATED void gconf_entry_free (GConfEntry *entry); #endif -void gconf_entry_ref (GConfEntry *entry); +GConfEntry* gconf_entry_ref (GConfEntry *entry); void gconf_entry_unref (GConfEntry *entry); /* Transfer ownership of value to the caller. */ -- cgit v1.2.1