From bc486c0de82986ec29f681850d89d7a023812b07 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 15 Sep 2021 08:43:53 +0800 Subject: [PATCH] fix build warnings nua.c:1101:16: warning: address of array 'nh->nh_ds' will always evaluate to 'true' [-Wpointer-bool-conversion] if (nh && nh->nh_ds) ~~ ~~~~^~~~~ nua.c:1110:16: warning: address of array 'nh->nh_home' will always evaluate to 'true' [-Wpointer-bool-conversion] if (nh && nh->nh_home) ~~ ~~~~^~~~~~~ nua.c:1119:18: warning: address of array 'nua->nua_home' will always evaluate to 'true' [-Wpointer-bool-conversion] if (nua && nua->nua_home) ~~ ~~~~~^~~~~~~~ nua.c:1150:16: warning: address of array 'nh->nh_ds' will always evaluate to 'true' [-Wpointer-bool-conversion] if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { ~~ ~~~~^~~~~ --- libsofia-sip-ua/nua/nua.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libsofia-sip-ua/nua/nua.c b/libsofia-sip-ua/nua/nua.c index 48360584..5c9ce3c8 100644 --- a/libsofia-sip-ua/nua/nua.c +++ b/libsofia-sip-ua/nua/nua.c @@ -89,7 +89,7 @@ su_log_t nua_log[] = { SU_LOG_INIT("nua", "NUA_DEBUG", SU_DEBUG) }; * @param root Pointer to a root object * @param callback Pointer to event callback function * @param magic Pointer to callback context - * @param tag, value, ... List of tagged parameters + * @param tag,value, ... List of tagged parameters * * @retval !=NULL a pointer to a @nua stack object * @retval NULL upon an error @@ -1098,7 +1098,7 @@ nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id) /** Get leg from dialog. */ const nta_leg_t *nua_get_dialog_state_leg(nua_handle_t *nh) { - if (nh && nh->nh_ds) + if (nh) return nh->nh_ds->ds_leg; else return NULL; @@ -1107,7 +1107,7 @@ const nta_leg_t *nua_get_dialog_state_leg(nua_handle_t *nh) /** Get su_home_t from nua handle. */ su_home_t *nua_handle_get_home(nua_handle_t *nh) { - if (nh && nh->nh_home) + if (nh) return nh->nh_home; else return NULL; @@ -1116,7 +1116,7 @@ su_home_t *nua_handle_get_home(nua_handle_t *nh) /** Get su_home_t from nua. */ su_home_t *nua_get_home(nua_t *nua) { - if (nua && nua->nua_home) + if (nua) return nua->nua_home; else return NULL; @@ -1147,7 +1147,7 @@ unsigned nua_handle_is_destroyed(nua_handle_t *nh) void nua_handle_dialog_usage_set_refresh_range(nua_handle_t *nh, unsigned min, unsigned max) { - if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { + if (nh && nh->nh_ds->ds_usage) { nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, min, max); } }