public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber•org>
To: netdev@vger•kernel.org
Cc: Stephen Hemminger <sthemmin@microsoft•com>
Subject: [PATCH iproute2-next 6/9] tc/util: remove unused print_size
Date: Mon,  9 Jul 2018 12:48:53 -0700	[thread overview]
Message-ID: <20180709194856.18922-7-stephen@networkplumber.org> (raw)
In-Reply-To: <20180709194856.18922-1-stephen@networkplumber.org>

From: Stephen Hemminger <sthemmin@microsoft•com>

Only sprint_size is used, so fold it in.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft•com>
---
 tc/tc_util.c | 7 ++-----
 tc/tc_util.h | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/tc/tc_util.c b/tc/tc_util.c
index f5ffe3443892..01e131b5c5d7 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -451,8 +451,9 @@ void print_devname(enum output_type type, int ifindex)
 			   "dev", "%s ", ifname);
 }
 
-void print_size(char *buf, int len, __u32 sz)
+char *sprint_size(__u32 sz, char *buf)
 {
+	const size_t len = SPRINT_BSIZE - 1;
 	double tmp = sz;
 
 	if (sz >= 1024*1024 && fabs(1024*1024*rint(tmp/(1024*1024)) - sz) < 1024)
@@ -461,11 +462,7 @@ void print_size(char *buf, int len, __u32 sz)
 		snprintf(buf, len, "%gKb", rint(tmp/1024));
 	else
 		snprintf(buf, len, "%ub", sz);
-}
 
-char *sprint_size(__u32 size, char *buf)
-{
-	print_size(buf, SPRINT_BSIZE-1, size);
 	return buf;
 }
 
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 56e214cbc8de..01c6a09a8839 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -84,7 +84,6 @@ int get_size_and_cell(unsigned int *size, int *cell_log, char *str);
 int get_time(unsigned int *time, const char *str);
 int get_linklayer(unsigned int *val, const char *arg);
 
-void print_size(char *buf, int len, __u32 size);
 void print_qdisc_handle(char *buf, int len, __u32 h);
 void print_time(char *buf, int len, __u32 time);
 void print_linklayer(char *buf, int len, unsigned int linklayer);
-- 
2.18.0

  parent reply	other threads:[~2018-07-09 19:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 19:48 [PATCH iproute2-next 0/9] TC more JSON support Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 1/9] tc: use JSON in error handling Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 2/9] tc: use const char in util Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 3/9] tc: convert stats print to json Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 4/9] tc/cbq: use sprint_rate Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 5/9] tc/util: remove print_rate Stephen Hemminger
2018-07-09 19:48 ` Stephen Hemminger [this message]
2018-07-09 19:48 ` [PATCH iproute2-next 7/9] tc/util: remove unused print_time Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 8/9] tc/util: add print helpers for JSON Stephen Hemminger
2018-07-09 19:48 ` [PATCH iproute2-next 9/9] tc/sfq: add json support Stephen Hemminger
2018-07-13 20:48 ` [PATCH iproute2-next 0/9] TC more JSON support David Ahern
2018-07-13 21:29   ` Jakub Kicinski
2018-07-13 22:22     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709194856.18922-7-stephen@networkplumber.org \
    --to=stephen@networkplumber$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=sthemmin@microsoft$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox