diff options
author | Thomas Graf <tgraf@suug.ch> | 2011-04-20 16:29:42 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2011-04-20 16:29:42 +0200 |
commit | fac48856087d11627bb7c2b78776529ceadc213a (patch) | |
tree | 2282c8e4c68f22312cb5c1c954c63bfce6b140b3 | |
parent | 4c6dd3a8bd0c6a69c1f5023fc38e16917bb12754 (diff) | |
download | libnl-fac48856087d11627bb7c2b78776529ceadc213a.tar.gz |
Improve readability of classid string representation
1: is more readable than 01:
-rw-r--r-- | lib/route/classid.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/route/classid.c b/lib/route/classid.c index 6af0ee3..abed244 100644 --- a/lib/route/classid.c +++ b/lib/route/classid.c @@ -106,7 +106,7 @@ static char *name_lookup(const uint32_t classid) * @return The destination buffer or the type encoded in hexidecimal * form if no match was found. */ -char * rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len) +char *rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len) { if (TC_H_ROOT == handle) snprintf(buf, len, "root"); @@ -120,11 +120,11 @@ char * rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len) if ((name = name_lookup(handle))) snprintf(buf, len, "%s", name); else if (0 == TC_H_MAJ(handle)) - snprintf(buf, len, ":%02x", TC_H_MIN(handle)); + snprintf(buf, len, ":%x", TC_H_MIN(handle)); else if (0 == TC_H_MIN(handle)) - snprintf(buf, len, "%02x:", TC_H_MAJ(handle) >> 16); + snprintf(buf, len, "%x:", TC_H_MAJ(handle) >> 16); else - snprintf(buf, len, "%02x:%02x", + snprintf(buf, len, "%x:%x", TC_H_MAJ(handle) >> 16, TC_H_MIN(handle)); } |