From: Jim Warner Date: Thu, 9 Jul 2020 05:00:00 +0000 (-0500) Subject: top: make that 'cpu_prt' function a tad more efficient X-Git-Tag: v3.3.17rc1~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e92b4c9ff212281b8f8b0228507476407a00947;p=procps-ng top: make that 'cpu_prt' function a tad more efficient 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 --- diff --git a/top/top.c b/top/top.c index 12eddfd7..0d48087d 100644 --- 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';