diff options
author | Коренберг Марк (дома) <socketpair@gmail.com> | 2012-08-29 17:59:17 (GMT) |
---|---|---|
committer | Коренберг Марк (дома) <socketpair@gmail.com> | 2012-08-29 21:19:04 (GMT) |
commit | ab15d06d13484df246eb0fbd9ab6a6012ed81153 (patch) | |
tree | 46ca57bdb8f7f31cbad6119e7ef33c74d9d54c00 /lib/route/cls/u32.c | |
parent | 582a32433ca03dd2ca78dc485329cb81d391a192 (diff) | |
download | libnl-ab15d06d13484df246eb0fbd9ab6a6012ed81153.zip libnl-ab15d06d13484df246eb0fbd9ab6a6012ed81153.tar.gz libnl-ab15d06d13484df246eb0fbd9ab6a6012ed81153.tar.bz2 |
"%llu" replaced with "%" PRIu64
On some architectures, uint64_t is defined as:
typedef unsigned long long int __u64;
on another architectures as:
typedef unsigned long int __u64;
So, according to man 3 printf,
uint64_t should be printed as "%llu" on some architectures, and as "%lu" on another. The same for scanf.
To eliminate that challenge, there is inttypes.h, in which appropriate constants
are defined for current architecture.
32-bit types (and even 16 and 8 bit types) should be printed using such constants if
printed variable defined as uint_XXXt or intXXXt type. But in reality 32-bit and less
types does not gain run-time error (except in scanf), because they pushed to stack as
32-bit values at least. So, I decide not to fix that.
Diffstat (limited to 'lib/route/cls/u32.c')
-rw-r--r-- | lib/route/cls/u32.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/route/cls/u32.c b/lib/route/cls/u32.c index d3e326d..aa9eb77 100644 --- a/lib/route/cls/u32.c +++ b/lib/route/cls/u32.c @@ -306,7 +306,7 @@ static void u32_dump_stats(struct rtnl_tc *tc, void *data, if (u->cu_mask & U32_ATTR_PCNT) { struct tc_u32_pcnt *pc = u->cu_pcnt->d_data; nl_dump(p, "\n"); - nl_dump_line(p, " hit %8llu count %8llu\n", + nl_dump_line(p, " hit %8" PRIu64 " count %8" PRIu64 "\n", pc->rhit, pc->rcnt); } } |