From a3ca768fbcd789868355f527bfaa7eceb244ed72 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 6 Oct 2021 17:55:11 +0200 Subject: [PATCH] std-aux: minor cleanup in nm_steal_int() to compare number explicitly against zero --- src/libnm-std-aux/nm-std-aux.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h index df8a4c1836..a0a7513e1f 100644 --- a/src/libnm-std-aux/nm-std-aux.h +++ b/src/libnm-std-aux/nm-std-aux.h @@ -1007,15 +1007,15 @@ _nm_auto_fclose(FILE **pfd) * Returns: *p_val and sets *p_val to zero the same time. * Accepts %NULL, in which case also numeric 0 will be returned. */ -#define nm_steal_int(p_val) \ - ({ \ - typeof(p_val) const _p_val = (p_val); \ - typeof(*_p_val) _val = 0; \ - \ - if (_p_val && (_val = *_p_val)) { \ - *_p_val = 0; \ - } \ - _val; \ +#define nm_steal_int(p_val) \ + ({ \ + typeof(p_val) const _p_val = (p_val); \ + typeof(*_p_val) _val = 0; \ + \ + if (_p_val && ((_val = *_p_val) != 0)) { \ + *_p_val = 0; \ + } \ + _val; \ }) static inline int