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 759391 - Add 'nullable'/'allow-none' to many return values
Add 'nullable'/'allow-none' to many return values
Status: RESOLVED DUPLICATE of bug 753520
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-12-13 00:10 UTC by Erika
Modified: 2015-12-15 12:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add nullable annotation to many return values (83.59 KB, patch)
2015-12-13 00:10 UTC, Erika
none Details | Review
Patch to add allow-none annotation to many return values (gtk2) (73.13 KB, patch)
2015-12-13 00:12 UTC, Erika
none Details | Review

Description Erika 2015-12-13 00:10:55 UTC
Created attachment 317259 [details] [review]
Patch to add nullable annotation to many return values

I did a simple grep over the code base to see where the human readable docs said that NULL could be returned but no `nullable`/`allow-none` annotation was present.
Comment 1 Erika 2015-12-13 00:12:15 UTC
Created attachment 317260 [details] [review]
Patch to add allow-none annotation to many return values (gtk2)
Comment 2 Alberto Ruiz 2015-12-14 11:54:19 UTC
Looks like we're trying to solve the same problem, but you've covered more functions: https://bugzilla.gnome.org/show_bug.cgi?id=753520


I have one comment though:

I don't understand why the use of allow-none in gtk2, allow-none is not used anymore for return values, nullables is the way to go, and GObject introspection is independent from gtk. I am pretty sure you ought to be using nullable there.
Comment 3 Erika 2015-12-14 19:31:57 UTC
@Alberto: I didn't find a single mention of 'nullable' in gtk2 branch, so I thought, I'd go with the already present style.
Comment 4 Alberto Ruiz 2015-12-15 12:11:19 UTC
(In reply to Erika from comment #3)
> @Alberto: I didn't find a single mention of 'nullable' in gtk2 branch, so I
> thought, I'd go with the already present style.

allow-none is only used for arguments not for return values, nullable was recently added

Also, you seemed to have added nullable to quite a few functions that return NULL only when an error occurs and constructors as well which should not be done.
Comment 5 Alberto Ruiz 2015-12-15 12:11:43 UTC

*** This bug has been marked as a duplicate of bug 753520 ***