diff options
author | Thomas Haller <thaller@redhat.com> | 2016-01-24 14:28:31 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-01-24 14:29:37 +0100 |
commit | 6c6ab10deaf55c824d08a03ad4493c60237e3989 (patch) | |
tree | 3e9d2654ecd32ba938f8a9692fa3f362cb7b73b5 /src/NetworkManagerUtils.h | |
parent | b9df6009ffbe2dea39b91972c52e426899f94c44 (diff) | |
download | NetworkManager-6c6ab10deaf55c824d08a03ad4493c60237e3989.tar.gz |
core/trivial: rename NM_UTILS_STRING_LOOKUP_TABLE* to NM_UTILS_LOOKUP*
Due to using a switch stetement, it is no longer only useful for looking
up strings, and it certainly doesn't use a table anymore.
Diffstat (limited to 'src/NetworkManagerUtils.h')
-rw-r--r-- | src/NetworkManagerUtils.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h index 09bbf42083..4f1516af48 100644 --- a/src/NetworkManagerUtils.h +++ b/src/NetworkManagerUtils.h @@ -260,11 +260,11 @@ const char *nm_utils_enum2str (const NMUtilsEnum2StrDesc *descs, /*****************************************************************************/ -#define NM_UTILS_STRING_LOOKUP_TABLE_ITEM(v, n) (void) 0; case v: return (n); (void) 0 -#define NM_UTILS_STRING_LOOKUP_TABLE_ITEM_S(v, n) NM_UTILS_STRING_LOOKUP_TABLE_ITEM(v, ""n"") +#define NM_UTILS_LOOKUP_ITEM(v, n) (void) 0; case v: return (n); (void) 0 +#define NM_UTILS_LOOKUP_STR_ITEM(v, n) NM_UTILS_LOOKUP_ITEM(v, ""n"") -#define _NM_UTILS_STRING_LOOKUP_TABLE_DEFINE(scope, fcn_name, lookup_type, unknown_val, ...) \ -scope const char * \ +#define _NM_UTILS_LOOKUP_DEFINE(scope, fcn_name, lookup_type, result_type, unknown_val, ...) \ +scope result_type \ fcn_name (lookup_type val) \ { \ switch (val) { \ @@ -276,15 +276,15 @@ fcn_name (lookup_type val) \ }; \ } -#define NM_UTILS_STRING_LOOKUP_TABLE_DEFINE(fcn_name, lookup_type, unknown_val, ...) \ - _NM_UTILS_STRING_LOOKUP_TABLE_DEFINE (, fcn_name, lookup_type, unknown_val, __VA_ARGS__) -#define NM_UTILS_STRING_LOOKUP_TABLE_DEFINE_STATIC(fcn_name, lookup_type, unknown_val, ...) \ - _NM_UTILS_STRING_LOOKUP_TABLE_DEFINE (static, fcn_name, lookup_type, unknown_val, __VA_ARGS__) +#define NM_UTILS_LOOKUP_STR_DEFINE(fcn_name, lookup_type, unknown_val, ...) \ + _NM_UTILS_LOOKUP_DEFINE (, fcn_name, lookup_type, const char *, unknown_val, __VA_ARGS__) +#define NM_UTILS_LOOKUP_STR_DEFINE_STATIC(fcn_name, lookup_type, unknown_val, ...) \ + _NM_UTILS_LOOKUP_DEFINE (static, fcn_name, lookup_type, const char *, unknown_val, __VA_ARGS__) /* Call the string-lookup-table function @fcn_name. If the function returns * %NULL, the numeric index is converted to string using a alloca() buffer. * Beware: this macro uses alloca(). */ -#define NM_UTILS_STRING_LOOKUP_TABLE(fcn_name, idx) \ +#define NM_UTILS_LOOKUP_STR(fcn_name, idx) \ ({ \ typeof (idx) _idx = (idx); \ const char *_s; \ |