Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-09-06 14:53:14 +0400
committerDenys Vlasenko <vda.linux@googlemail.com>2013-09-06 14:53:14 +0400
commita407cf74cc43c3cc26168e259cee469a4787a76c (patch)
tree2306029e1ea7b957825b55e3728d23c886da58dd /procps
parentd6ae4fb446daedfe3073d67be655942e9fa7eb18 (diff)
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 <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/nmeter.c3
-rw-r--r--procps/powertop.c3
-rw-r--r--procps/ps.c9
-rw-r--r--procps/top.c3
4 files changed, 6 insertions, 12 deletions
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 6a3b32743..5d5b83b8d 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -333,8 +333,7 @@ static void scale(ullong ul)
char buf[5];
/* see http://en.wikipedia.org/wiki/Tera */
- smart_ulltoa4(ul, buf, " kmgtpezy");
- buf[4] = '\0';
+ smart_ulltoa4(ul, buf, " kmgtpezy")[0] = '\0';
put(buf);
}
diff --git a/procps/powertop.c b/procps/powertop.c
index 71988a295..e3c29d1c3 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -627,7 +627,6 @@ static void show_timerstats(void)
int i, n = 0;
char strbuf6[6];
- strbuf6[5] = '\0';
puts("\nTop causes for wakeups:");
for (i = 0; i < G.lines_cnt; i++) {
if ((G.lines[i].count > 0 /*|| G.lines[i].disk_count > 0*/)
@@ -639,7 +638,7 @@ static void show_timerstats(void)
/*char c = ' ';
if (G.lines[i].disk_count)
c = 'D';*/
- smart_ulltoa5(G.lines[i].count, strbuf6, " KMGTPEZY");
+ smart_ulltoa5(G.lines[i].count, strbuf6, " KMGTPEZY")[0] = '\0';
printf(/*" %5.1f%% (%s)%c %s\n"*/
" %5.1f%% (%s) %s\n",
G.lines[i].count * 100.0 / G.lines_cumulative_count,
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
diff --git a/procps/top.c b/procps/top.c
index abee69806..a13a41cd8 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -847,8 +847,7 @@ static void display_topmem_header(int scr_width, int *lines_rem_p)
static void ulltoa6_and_space(unsigned long long ul, char buf[6])
{
/* see http://en.wikipedia.org/wiki/Tera */
- smart_ulltoa5(ul, buf, " mgtpezy");
- buf[5] = ' ';
+ smart_ulltoa5(ul, buf, " mgtpezy")[0] = '\0';
}
static NOINLINE void display_topmem_process_list(int lines_rem, int scr_width)