Add macro for possible NULL prints and use it on known sports

The macro is effective on OpenBSD and basically a no op on other platforms.
Use it for one existing and the other known debug statements.
This commit is contained in:
the xhr
2023-01-09 17:58:01 +01:00
parent 6ceafac6aa
commit 714add207b
4 changed files with 11 additions and 5 deletions

View File

@@ -191,11 +191,11 @@ omemo_start_device_session_handle_bundle(xmpp_stanza_t* const stanza, void* cons
char* from = NULL;
const char* from_attr = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
log_debug("[OMEMO] omemo_start_device_session_handle_bundle: %s", (from_attr == NULL) ? "" : from_attr);
log_debug("[OMEMO] omemo_start_device_session_handle_bundle: %s", STR_MAYBE_NULL(from_attr));
const char* type = xmpp_stanza_get_type(stanza);
if (g_strcmp0(type, "error") == 0) {
log_error("[OMEMO] Error to get key for a device from : %s", from_attr);
log_error("[OMEMO] Error to get key for a device from : %s", STR_MAYBE_NULL(from_attr));
}
if (!from_attr) {