summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-07-05 16:15:59 +0200
committerThomas Haller <thaller@redhat.com>2020-07-06 14:11:22 +0200
commitd407c1271c26d34dc4ffd429d7e838ec30573ece (patch)
tree0f82c6fb38694208ae06176830f48d22c5661179
parent220825836a8e9d03e4b934aeaff31215ac4abffa (diff)
downloadNetworkManager-d407c1271c26d34dc4ffd429d7e838ec30573ece.tar.gz
shared: move NM_SET_OUT() to "nm-std-aux.h"
-rw-r--r--shared/nm-glib-aux/nm-macros-internal.h14
-rw-r--r--shared/nm-std-aux/nm-std-aux.h16
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__ */