Patches to add basic support for the Suunto EON Steel
Jef Driesen
jef at libdivecomputer.org
Mon Nov 3 15:18:28 PST 2014
On 03-11-14 17:23, Linus Torvalds wrote:
>
> On Nov 3, 2014 8:12 AM, "Jef Driesen" <jef at libdivecomputer.org
> <mailto:jef at libdivecomputer.org>> wrote:
> >
> >
> > I still prefer to have proper integration of the logging functions. Calling
> ERROR from your report_error is an ugly hack that throws away several of the
> nice features of the ERROR macro.
>
> By it fixes one huge big mistake in that macro namely the broken return value.
> Even if I could use the enums (which are not appropriate), the enum you return
> is useless, since it's "success*.
Now I realize why you have been complaining about the logging functions and the
dc_status_t enum. It's about the return value of the dc_context_log() function
itself, which indicates whether the logging was successful or not. Of course
that's not what you want to return from the backend code. The return value of
the logging function is nearly alway irrelevant, and you typically just ignore it:
if (failure) {
ERROR(context, "Some error message.");
return -1; /* or some DC_STATUS_XXX value depending on the function */
}
That's completely independent from the question about returning -1 or an enum
value. The above construct works for both.
And other then being a bit more verbose with one line extra, how's that
different compared to yours:
if (failure) {
return report_error("Some error message."); /* Returns -1 */
}
Jef
More information about the devel
mailing list