summaryrefslogtreecommitdiff
path: root/examples/python/python-networkmanager
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-12-07 14:28:09 +0100
committerThomas Haller <thaller@redhat.com>2015-12-07 14:41:32 +0100
commit0a6cca945099b2b91cea2a7eb763ab44dd4129df (patch)
tree73470c73f5f0aafd187954a0e99c87bba98a329d /examples/python/python-networkmanager
parenta291ecc29c77ea55e902f7c30bef859ae47f5e45 (diff)
downloadNetworkManager-0a6cca945099b2b91cea2a7eb763ab44dd4129df.tar.gz
device: use NM_UTILS_STRING_LOOKUP_TABLE() for reason_to_string()
Showcase for the new macros NM_UTILS_STRING_LOOKUP_TABLE() and NM_UTILS_STRING_LOOKUP_TABLE_DEFINE_STATIC(). It changes behavior in case of looking up an invalid/unknown state reason. Previously it would just have returned "unknown" -- which was indistinguishable from a regular "unknown" value. Now it returns the numeric id as a string. The string is allocated with alloca(), which is desired but one should be aware of the pitfalls: - prevents the caller from being inlined - bad idea to do in a loop.
Diffstat (limited to 'examples/python/python-networkmanager')
0 files changed, 0 insertions, 0 deletions