diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-19 12:48:56 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-05-19 12:48:56 +0000 |
commit | e2922e42a00b3d247368a2c1f32740771aaae0cb (patch) | |
tree | f0a351a4d9e421f19ed2e954220c380e99ab0f14 | |
parent | 38583fd6f2aa8eb0a9844f3a85d0f0a07eee88ed (diff) | |
download | busybox-w32-e2922e42a00b3d247368a2c1f32740771aaae0cb.tar.gz busybox-w32-e2922e42a00b3d247368a2c1f32740771aaae0cb.tar.bz2 busybox-w32-e2922e42a00b3d247368a2c1f32740771aaae0cb.zip |
- make it C89 compatible; Declarations in the middle of a function is of course
fine in C99, but it really serves no purpose other than breaking compilation
on C89 compilers.
Thanks to Rich Felker for pointing this out.
-rw-r--r-- | procps/top.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/procps/top.c b/procps/top.c index 2dd171971..691b4ea7e 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -338,20 +338,21 @@ static void display_status(int count, int scr_width) | |||
338 | while (count--) { | 338 | while (count--) { |
339 | div_t pmem = div( (s->rss*pmem_scale) >> pmem_shift, 10); | 339 | div_t pmem = div( (s->rss*pmem_scale) >> pmem_shift, 10); |
340 | int col = scr_width+1; | 340 | int col = scr_width+1; |
341 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(div_t pcpu;) | ||
341 | 342 | ||
342 | if (s->rss >= 100*1024) | 343 | if (s->rss >= 100*1024) |
343 | sprintf(rss_str_buf, "%6ldM", s->rss/1024); | 344 | sprintf(rss_str_buf, "%6ldM", s->rss/1024); |
344 | else | 345 | else |
345 | sprintf(rss_str_buf, "%7ld", s->rss); | 346 | sprintf(rss_str_buf, "%7ld", s->rss); |
346 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(div_t pcpu = div((s->pcpu*pcpu_scale) >> pcpu_shift, 10)); | 347 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu = div((s->pcpu*pcpu_scale) >> pcpu_shift, 10);) |
347 | col -= printf("\n%5d %-8s %s %s%6d%3u.%c" \ | 348 | col -= printf("\n%5d %-8s %s %s%6d%3u.%c" \ |
348 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE("%3u.%c") " ", | 349 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE("%3u.%c") " ", |
349 | s->pid, s->user, s->state, rss_str_buf, s->ppid, | 350 | s->pid, s->user, s->state, rss_str_buf, s->ppid, |
350 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu.quot, '0'+pcpu.rem,) | 351 | USE_FEATURE_TOP_CPU_USAGE_PERCENTAGE(pcpu.quot, '0'+pcpu.rem,) |
351 | pmem.quot, '0'+pmem.rem); | 352 | pmem.quot, '0'+pmem.rem); |
352 | if (col>0) | 353 | if (col>0) |
353 | printf("%.*s", col, s->short_cmd); | 354 | printf("%.*s", col, s->short_cmd); |
354 | /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu, | 355 | /* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu, |
355 | jif.busy - prev_jif.busy, jif.total - prev_jif.total); */ | 356 | jif.busy - prev_jif.busy, jif.total - prev_jif.total); */ |
356 | s++; | 357 | s++; |
357 | } | 358 | } |