]> granicus.if.org Git - procps-ng/commitdiff
top: make that 'cpu_prt' function a tad more efficient
authorJim Warner <james.warner@comcast.net>
Thu, 9 Jul 2020 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Mon, 20 Jul 2020 06:12:00 +0000 (16:12 +1000)
This commit only eliminates two 'nop' instructions and
one 'jmp' instruction. However, it makes that C source
code look a little bit prettier than it looked before.

[ and yes, some unnecessary parenthesis were used to ]
[ force an alignment of some related lines. it costs ]
[ us nothing in extra code yet helps in readability. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 12eddfd7ea2e4519231dd7639e1ea0ec4b3e7bc3..0d48087d7eff3da7171857944c50a8176127a4c4 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5736,14 +5736,13 @@ static inline int cpu_prt (const char *str, int nobuf) {
    char *p;
 
    p = scat(row, str);
-   if (nobuf || !Curwin->rc.double_up)
-      goto flush_it;
-   if (!tog) {
+   if (Curwin->rc.double_up
+   && (!nobuf)
+   && (!tog)) {
       scat(p, Double_sp);
       tog = 1;
       return 0;
    }
-flush_it:
    scat(p, "\n");
    show_special(0, row);
    row[0] = '\0';