diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2019-08-30 00:46:13 +0200 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2019-08-30 14:09:42 +0200 |
commit | f89cbd0019393ed8aeefa8b633e330982c8ab126 (patch) | |
tree | 592dd0aa17bd78b14ca72916898179a340c317fb | |
parent | 079693d22f6e3b4577b482aac2634b88faeb339d (diff) |
OSMO_SOCKADDR_STR_FMT_ARGS: guard against NULL pointer
The pointless '(R)->ip?' condition of the previous commit made me want to
protect against R == NULL instead.
Change-Id: Ie2f47ad8ae585aaf67a6476c67f8e014820a72bc
-rw-r--r-- | include/osmocom/core/sockaddr_str.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/osmocom/core/sockaddr_str.h b/include/osmocom/core/sockaddr_str.h index 7c01732d..d16dc86f 100644 --- a/include/osmocom/core/sockaddr_str.h +++ b/include/osmocom/core/sockaddr_str.h @@ -62,7 +62,7 @@ struct osmo_sockaddr_str { * printf("got " OSMO_SOCKADDR_STR_FMT "\n", OSMO_SOCKADDR_STR_FMT_ARGS(my_sockaddr_str)); */ #define OSMO_SOCKADDR_STR_FMT "%s:%u" -#define OSMO_SOCKADDR_STR_FMT_ARGS(R) (R)->ip, (R)->port +#define OSMO_SOCKADDR_STR_FMT_ARGS(R) ((R)? (R)->ip : "NULL"), ((R)? (R)->port : 0) bool osmo_sockaddr_str_is_set(const struct osmo_sockaddr_str *sockaddr_str); |