Patchwork libnetfilter_acct: use PRIu64 and remove unnecessary cast

login
register
mail settings
Submitter Mr Dash Four
Date March 5, 2013, 6:40 p.m.
Message ID <51363C27.3020305@googlemail.com>
Download mbox | patch
Permalink /patch/225150/
State Accepted
Headers show

Comments

Mr Dash Four - March 5, 2013, 6:40 p.m.
This patch corrects all nfacct_snprintf_* functions to use PRIu64,
given that we are using uint64_t type variables and also removes
the unnecessary casts.

Signed-off-by: Mr Dash Four <mr.dash.four@googlemail.com>
---
  src/libnetfilter_acct.c |   11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - March 15, 2013, 11:47 a.m.
On Tue, Mar 05, 2013 at 06:40:39PM +0000, Mr Dash Four wrote:
> This patch corrects all nfacct_snprintf_* functions to use PRIu64,
> given that we are using uint64_t type variables and also removes
> the unnecessary casts.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mr Dash Four - March 16, 2013, 2:06 p.m.
Pablo Neira Ayuso wrote:
> On Tue, Mar 05, 2013 at 06:40:39PM +0000, Mr Dash Four wrote:
>   
>> This patch corrects all nfacct_snprintf_* functions to use PRIu64,
>> given that we are using uint64_t type variables and also removes
>> the unnecessary casts.
>>     
>
> Applied, thanks.
>   
Applied where Pablo? I can't see any commits done on the main 
libnetfilter_acct tree for 13 days?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/src/libnetfilter_acct.c b/src/libnetfilter_acct.c
index 0abaeac..ba89e2d 100644
--- a/src/libnetfilter_acct.c
+++ b/src/libnetfilter_acct.c
@@ -13,6 +13,7 @@ 
  #include <endian.h>
  #include <stdlib.h>
  #include <string.h>
+#include <inttypes.h>

  #include <libmnl/libmnl.h>
  #include <linux/netfilter/nfnetlink.h>
@@ -235,10 +236,8 @@  nfacct_snprintf_plain(char *buf, size_t rem, struct nfacct *nfacct,

  	if (flags & NFACCT_SNPRINTF_F_FULL) {
  		ret = snprintf(buf, rem,
-			"{ pkts = %.20llu, bytes = %.20llu } = %s;",
-			(unsigned long long)
+			"{ pkts = %.20"PRIu64", bytes = %.20"PRIu64" } = %s;",
  			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS),
-			(unsigned long long)
  			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
  			nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME));
  	} else {
@@ -296,12 +295,10 @@  nfacct_snprintf_xml(char *buf, size_t rem, struct nfacct *nfacct,

  	ret = snprintf(buf, rem,
  			"<obj><name>%s</name>"
-			"<pkts>%.20llu</pkts>"
-			"<bytes>%.20llu</bytes>",
+			"<pkts>%.20"PRIu64"</pkts>"
+			"<bytes>%.20"PRIu64"</bytes>",
  			nfacct_attr_get_str(nfacct, NFACCT_ATTR_NAME),
-			(unsigned long long)
  			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_BYTES),
-			(unsigned long long)
  			nfacct_attr_get_u64(nfacct, NFACCT_ATTR_PKTS));
  	BUFFER_SIZE(ret, size, rem, offset);