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 631413 - Add macros for GSourceFunc return values
Add macros for GSourceFunc return values
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: mainloop
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-10-05 13:06 UTC by Emmanuele Bassi (:ebassi)
Modified: 2011-09-10 02:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add macros for GSourceFunc return values (1.79 KB, patch)
2010-10-05 13:06 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Emmanuele Bassi (:ebassi) 2010-10-05 13:06:32 UTC
Even after 10 years of developing with GLib and GNOME, I still have to look at Devhelp to remember the return values for GSourceFunc, like g_timeout_add() and g_idle_add().

The Perl bindings for GLib have two nice constants for these occasions that remove some of the confusion out of the boolean return value: G_SOURCE_CONTINUE and G_SOURCE_REMOVE. It would be a good idea to poach them, and have them directly inside GLib.
Comment 1 Emmanuele Bassi (:ebassi) 2010-10-05 13:06:36 UTC
Created attachment 171762 [details] [review]
Add macros for GSourceFunc return values

The boolean values to be returned by a GSourceFunc are always ambiguous,
and even in case of experienced developers then can lead to confusion.

The Perl bindings for GLib have two simple constants, mapping to TRUE
and FALSE, that make the return values less confusing: G_SOURCE_CONTINUE
and G_SOURCE_REMOVE respectively.
Comment 2 Benjamin Otte (Company) 2010-10-05 13:14:42 UTC
Question: Can we get an enum in an API-stable way?
It shouldn't be a problem in C code, but I'm not sure what bindings would do if functions suddenly returned an enum with two values mapped to TRUE and FALSE.