summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-01-24 11:35:26 +0100
committerThomas Haller <thaller@redhat.com>2016-01-24 14:20:57 +0100
commit8956ea661c1f591eba73a8a775ce56eff986003d (patch)
treeb0816d7e0690328651db810924ca222b0a604d3f
parent0ce83890bfb8653e06e3882aed3f9e28234642c8 (diff)
downloadNetworkManager-8956ea661c1f591eba73a8a775ce56eff986003d.tar.gz
utils: add NM_UTILS_STRING_LOOKUP_TABLE_ITEM() macro
-rw-r--r--src/NetworkManagerUtils.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h
index 1920c3d5bb..d6676481ee 100644
--- a/src/NetworkManagerUtils.h
+++ b/src/NetworkManagerUtils.h
@@ -260,6 +260,9 @@ const char *nm_utils_enum2str (const NMUtilsEnum2StrDesc *descs,
/*****************************************************************************/
+#define NM_UTILS_STRING_LOOKUP_TABLE_ITEM(v, n) [v] = n
+#define NM_UTILS_STRING_LOOKUP_TABLE_ITEM_S(v, n) NM_UTILS_STRING_LOOKUP_TABLE_ITEM(v, ""n"")
+
#define _NM_UTILS_STRING_LOOKUP_TABLE_DEFINE(scope, fcn_name, lookup_type, unknown_val, ...) \
scope const char * \
fcn_name (lookup_type idx) \