top: make that 'forest view' just a tad more efficient

It makes no sense to begin our tracked nested level at
'1' then later require a '1' to be subtracted from the
level as artwork and indentation is added for display.

By beginning such tracked levels at zero, we can avoid
the need to adjust it & use it directly in a snprintf.

[ this commit parallels a patch in our newlib branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-10-08 10:10:10 -05:00 committed by Craig Small
parent 98ed114c26
commit c6407ef125

View File

@ -4970,7 +4970,7 @@ static void forest_create (WIN_t *q) {
#endif
for (i = 0; i < Frame_maxtask; i++) // avoid any hidepid distortions
if (!Seed_ppt[i]->pad_3) // identify real or pretend trees
forest_adds(i, 1); // add as parent plus its children
forest_adds(i, 0); // add as parent plus its children
}
memcpy(Seed_ppt, Tree_ppt, sizeof(proc_t*) * Frame_maxtask);
} // end: forest_create
@ -4987,9 +4987,9 @@ static inline const char *forest_display (const WIN_t *q, const proc_t *p) {
#endif
const char *which = (CHKw(q, Show_CMDLIN)) ? *p->cmdline : p->cmd;
if (!CHKw(q, Show_FOREST) || 1 == p->pad_3) return which;
if (!CHKw(q, Show_FOREST) || !p->pad_3) return which;
if (p->pad_3 > 100) snprintf(buf, sizeof(buf), "%400s%s", " + ", which);
else snprintf(buf, sizeof(buf), "%*s%s", 4 * (p->pad_3 - 1), " `- ", which);
else snprintf(buf, sizeof(buf), "%*s%s", (4 * p->pad_3), " `- ", which);
return buf;
} // end: forest_display