std-aux: minor cleanup in nm_steal_int() to compare number explicitly against zero

This commit is contained in:
Thomas Haller 2021-10-06 17:55:11 +02:00
parent 6b3862e39a
commit a3ca768fbc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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