summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-08-18 16:10:38 +0200
committerFrancesco Giudici <fgiudici@redhat.com>2016-04-11 15:32:48 +0200
commita72dd80a944afcc08538ecee22d00b6a9c069d0d (patch)
tree5af133058597b9af645c04dfb5fd8b99db38455d
parent70c0defe753bc98ac75725cc32a84b36f32258e4 (diff)
downloadNetworkManager-a72dd80a944afcc08538ecee22d00b6a9c069d0d.tar.gz
macros: add NM_SET_OUT() macro
(cherry picked from commit d4d2e65eb7fee4486e386e62a2f9d405c320e1f0)
-rw-r--r--include/nm-macros-internal.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/nm-macros-internal.h b/include/nm-macros-internal.h
index 123c49bbc6..d5a8ec5228 100644
--- a/include/nm-macros-internal.h
+++ b/include/nm-macros-internal.h
@@ -111,6 +111,15 @@
/* macro to return strlen() of a compile time string. */
#define STRLEN(str) ( sizeof ("" str) - 1 )
+#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
+
/********************************************************/
#define _NM_IN_SET_EVAL_1(op, x, y1) \