GNOME Bugzilla – Bug 658315
g_key_file_get_keys() should set length to 0 if there is an error
Last modified: 2012-01-16 04:19:33 UTC
That's what I would have expected and makes things easier if one don't care if an error has been returned or not.
Created attachment 195751 [details] [review] g_key_file_get_keys: set length to 0 if an error is raised
I feel like the default assumption with GError is that if an error is thrown, then you can't depend on the values of out variables. http://developer.gnome.org/glib/stable/glib-Error-Reporting.html does not say either way though...
There's no general rule that 'out variables shall always be set'. So, if a function wants to guarantee that they will be set to known values even in the error case, that needs to be documented. That isn't the case case for g_key_file_get_keys(). As Dan says, we should probably clarify the expectations in the GError docs.
Documented this now