GNOME Bugzilla – Bug 743164
Always normalize boolean setters
Last modified: 2015-01-20 04:56:21 UTC
While browsing the code I noticed that at least some of the boolean setters are not normalizing the input value. It is a good practice to always do foo_set_bar(gboolean x) { x = !!x; ... } in case the caller passes in an integer value different from TRUE/FALSE
It would be nice to have, but I get the feeling that since we don't use "x = 1" type statements in our code base, that this type of bug wouldn't be very common. I also hope that G-I sends the right thing (when we finally get to opening that up).
i guess in general, we'd be more likely to hit it when assigning from pointers accidentally. at least those will warn with --enable-maintainer-flags though.
Created attachment 294942 [details] [review] convention: use !! to normalize boolean params and guint 1 bit flag
Attachment 294942 [details] pushed as 9873d28 - convention: use !! to normalize boolean params and guint 1 bit flag