shared: move NM_SET_OUT() to "nm-std-aux.h"

This commit is contained in:
Thomas Haller 2020-07-05 16:15:59 +02:00
parent 220825836a
commit d407c1271c
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 16 additions and 14 deletions

View file

@ -430,20 +430,6 @@ NM_G_ERROR_MSG (GError *error)
_n; \
})
/* Note: @value is only evaluated when *out_val is present.
* Thus,
* NM_SET_OUT (out_str, g_strdup ("hallo"));
* does the right thing.
*/
#define NM_SET_OUT(out_val, value) \
G_STMT_START { \
typeof(*(out_val)) *_out_val = (out_val); \
\
if (_out_val) { \
*_out_val = (value); \
} \
} G_STMT_END
/*****************************************************************************/
#ifndef _NM_CC_SUPPORT_AUTO_TYPE

View file

@ -174,4 +174,20 @@
/*****************************************************************************/
/* Note: @value is only evaluated when *out_val is present.
* Thus,
* NM_SET_OUT (out_str, g_strdup ("hallo"));
* does the right thing.
*/
#define NM_SET_OUT(out_val, value) \
({ \
typeof(*(out_val)) *_out_val = (out_val); \
\
if (_out_val) { \
*_out_val = (value); \
} \
\
(!!_out_val); \
})
#endif /* __NM_STD_AUX_H__ */