From 4188af73af2b897aadf258ab3d7c31e03745a0f9 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Wed, 27 Jul 2022 16:05:43 +0200 Subject: [PATCH] sip: origin: Drop comparison that always evaluates as true MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids the following warning: ../plugins/sip/calls-sip-origin.c: In function ‘sip_r_register’: ../plugins/sip/calls-sip-origin.c:483:26: warning: the comparison will always evaluate as ‘true’ for the address of ‘m_url’ will never be NULL [-Waddress] 483 | if (sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_host) { | ^~ In file included from /usr/include/sofia-sip-1.12/sofia-sip/nua.h:47, from ../plugins/sip/calls-sip-util.h:28, from ../plugins/sip/calls-sip-call.h:30, from ../plugins/sip/calls-sip-origin.c:31: /usr/include/sofia-sip-1.12/sofia-sip/sip.h:477:23: note: ‘m_url’ declared here 477 | url_t m_url[1]; /**< SIP URL */ | ^~~~~ ../plugins/sip/calls-sip-origin.c: In function ‘sip_callback’: ../plugins/sip/calls-sip-origin.c:779:23: warning: the comparison will always evaluate as ‘true’ for the address of ‘a_url’ will never be NULL [-Waddress] 779 | if (sip->sip_from && sip->sip_from->a_url && | ^~ /usr/include/sofia-sip-1.12/sofia-sip/sip.h:386:22: note: ‘a_url’ declared here 386 | url_t a_url[1]; /**< URL */ | ^~~~~ --- plugins/sip/calls-sip-origin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c index 933422d..e35d826 100644 --- a/plugins/sip/calls-sip-origin.c +++ b/plugins/sip/calls-sip-origin.c @@ -480,7 +480,7 @@ sip_r_register (int status, if (!origin->contact_header) nua_get_params (nua, TAG_ANY (), TAG_END ()); - if (sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_host) { + if (sip->sip_contact && sip->sip_contact->m_url->url_host) { if (g_strcmp0 (origin->own_ip, sip->sip_contact->m_url->url_host) == 0) return; @@ -776,7 +776,7 @@ sip_callback (nua_event_t event, switch (event) { case nua_i_invite: - if (sip->sip_from && sip->sip_from->a_url && + if (sip->sip_from && sip->sip_from->a_url->url_scheme && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host)