From a407cf74cc43c3cc26168e259cee469a4787a76c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 6 Sep 2013 12:53:14 +0200 Subject: Make smart_ulltoa return pointer to end (allows for code shink in callers) function old new delta smart_ulltoa5 405 408 +3 smart_ulltoa4 273 276 +3 list_table 1113 1114 +1 scale 36 34 -2 put_lu 55 53 -2 ulltoa6_and_space 19 14 -5 powertop_main 1470 1461 -9 Signed-off-by: Denys Vlasenko --- procps/ps.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'procps/ps.c') diff --git a/procps/ps.c b/procps/ps.c index 89cadad00..c65fa012a 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -299,8 +299,7 @@ static void put_lu(char *buf, int size, unsigned long u) char buf4[5]; /* see http://en.wikipedia.org/wiki/Tera */ - smart_ulltoa4(u, buf4, " mgtpezy"); - buf4[4] = '\0'; + smart_ulltoa4(u, buf4, " mgtpezy")[0] = '\0'; sprintf(buf, "%.*s", size, buf4); } @@ -740,8 +739,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) #endif { char buf6[6]; - smart_ulltoa5(p->vsz, buf6, " mgtpezy"); - buf6[5] = '\0'; + smart_ulltoa5(p->vsz, buf6, " mgtpezy")[0] = '\0'; #if ENABLE_FEATURE_PS_LONG if (opts & OPT_l) { char bufr[6], stime_str[6]; @@ -752,8 +750,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) time_t start = now - elapsed; struct tm *tm = localtime(&start); - smart_ulltoa5(p->rss, bufr, " mgtpezy"); - bufr[5] = '\0'; + smart_ulltoa5(p->rss, bufr, " mgtpezy")[0] = '\0'; if (p->tty_major == 136) /* It should be pts/N, not ptsN, but N > 9 -- cgit v1.2.3