From 1cc09188079a64dc8b733f198c959cfb441e6e20 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 2 Aug 2018 17:05:16 +0200 Subject: xshared: Consolidate parse_counters() Move this helper function into xshared. While being at it, drop the need for temporary variables and take over null pointer tolerance from the implementation in iptables-xml.c. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- iptables/iptables-restore.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'iptables/iptables-restore.c') diff --git a/iptables/iptables-restore.c b/iptables/iptables-restore.c index e52e8e47..a1ae0311 100644 --- a/iptables/iptables-restore.c +++ b/iptables/iptables-restore.c @@ -76,17 +76,6 @@ static struct xtc_handle *create_handle(const char *tablename) return handle; } -static int parse_counters(char *string, struct xt_counters *ctr) -{ - unsigned long long pcnt, bcnt; - int ret; - - ret = sscanf(string, "[%llu:%llu]", &pcnt, &bcnt); - ctr->pcnt = pcnt; - ctr->bcnt = bcnt; - return ret == 2; -} - /* global new argv and argc */ static char *newargv[255]; static int newargc; -- cgit v1.2.3