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 731584 - gbookmarkfile: Cleaner error handling code to pacify static analysis
gbookmarkfile: Cleaner error handling code to pacify static analysis
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-06-12 16:55 UTC by Colin Walters
Modified: 2014-06-12 17:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gbookmarkfile: Cleaner error handling code to pacify static analysis (2.01 KB, patch)
2014-06-12 16:55 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2014-06-12 16:55:00 UTC
A static analyzer flagged the g_file_get_contents() call as not
checking its return value.  While the code here is actually correct,
it's verbose at best.

I think the "goto out + cleanup" code style is substantially cleaner,
less error prone, and easier to read.  It also will pacify the static
analyzer.
Comment 1 Colin Walters 2014-06-12 16:55:02 UTC
Created attachment 278357 [details] [review]
gbookmarkfile: Cleaner error handling code to pacify static analysis
Comment 2 Emmanuele Bassi (:ebassi) 2014-06-12 17:04:08 UTC
Review of attachment 278357 [details] [review]:

looks good, with one minor coding style tweak; if you could fix it before pushing it would be great...

::: glib/gbookmarkfile.c
@@ +1686,1 @@
+  if (!g_bookmark_file_load_from_data (bookmark,

the arguments can go on the same line.
Comment 3 Colin Walters 2014-06-12 17:25:19 UTC
Attachment 278357 [details] pushed as f7d7e5a - gbookmarkfile: Cleaner error handling code to pacify static analysis