From d407c1271c26d34dc4ffd429d7e838ec30573ece Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 5 Jul 2020 16:15:59 +0200 Subject: [PATCH] shared: move NM_SET_OUT() to "nm-std-aux.h" --- shared/nm-glib-aux/nm-macros-internal.h | 14 -------------- shared/nm-std-aux/nm-std-aux.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 493df8f1b4..184ef397e2 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -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 diff --git a/shared/nm-std-aux/nm-std-aux.h b/shared/nm-std-aux/nm-std-aux.h index 7c76c6d8c9..af58741d11 100644 --- a/shared/nm-std-aux/nm-std-aux.h +++ b/shared/nm-std-aux/nm-std-aux.h @@ -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__ */