[PATCH] do not call _dbus_warn_check_failed on checks
Havoc Pennington
hp at redhat.com
Mon Nov 13 10:08:51 PST 2006
Oh, to clarify asserts vs. checks. The difference is not whether they
exit (it is configurable for checks), but what is being sanity-checked.
checks can appear only on public API and they are supposed to check up
on data provided by the application (library user). Assertions are
supposed to check up on libdbus's internal consistency. So while it's
tough to draw a 100% bright line, in general if an assertion fails we'd
expect a dbus bug and if a check fails we'd expect an application bug.
This is perhaps most nicely summed up by the assertion at the start of
the check macros:
#define _dbus_return_if_fail(condition) do {
\
_dbus_assert ((*(const char*)_DBUS_FUNCTION_NAME) != '_');
\
if (!(condition)) {
\
_dbus_warn_check_failed (_dbus_return_if_fail_warning_format,
\
_DBUS_FUNCTION_NAME, #condition, __FILE__,
__LINE__); \
return;
\
} } while (0)
i.e. there we assert that the check is not used on internal functions
that start with underscore.
Havoc
More information about the dbus
mailing list