diff options
author | the xhr <xhr@giessen.ccc.de> | 2023-01-09 17:58:01 +0100 |
---|---|---|
committer | the xhr <xhr@giessen.ccc.de> | 2023-01-26 17:42:52 +0100 |
commit | 714add207b26e8d80e3ca945f111bfd5d6027c88 (patch) | |
tree | 09050b504c7d9cfc14c9e761efdfa888c9d0389c /src/xmpp | |
parent | 6ceafac6aa050f281375cb5d5bc9856a8309450c (diff) | |
download | profani-tty-714add207b26e8d80e3ca945f111bfd5d6027c88.tar.gz |
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.
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/message.c | 2 | ||||
-rw-r--r-- | src/xmpp/omemo.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c index bc716b24..015d4157 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -654,7 +654,7 @@ message_send_chat_omemo(const char* const jid, uint32_t sid, GList* keys, xmpp_stanza_t* key_stanza = xmpp_stanza_new(ctx); xmpp_stanza_set_name(key_stanza, "key"); char* rid = g_strdup_printf("%d", key->device_id); - log_debug("[OMEMO] Sending to device rid %s", rid == NULL ? "NULL" : rid); + log_debug("[OMEMO] Sending to device rid %s", STR_MAYBE_NULL(rid)); xmpp_stanza_set_attribute(key_stanza, "rid", rid); g_free(rid); if (key->prekey) { diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c index 70fdd733..e1bdbc3e 100644 --- a/src/xmpp/omemo.c +++ b/src/xmpp/omemo.c @@ -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) { |