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:
parent
98ed114c26
commit
c6407ef125
@ -4970,7 +4970,7 @@ static void forest_create (WIN_t *q) {
|
|||||||
#endif
|
#endif
|
||||||
for (i = 0; i < Frame_maxtask; i++) // avoid any hidepid distortions
|
for (i = 0; i < Frame_maxtask; i++) // avoid any hidepid distortions
|
||||||
if (!Seed_ppt[i]->pad_3) // identify real or pretend trees
|
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);
|
memcpy(Seed_ppt, Tree_ppt, sizeof(proc_t*) * Frame_maxtask);
|
||||||
} // end: forest_create
|
} // end: forest_create
|
||||||
@ -4987,9 +4987,9 @@ static inline const char *forest_display (const WIN_t *q, const proc_t *p) {
|
|||||||
#endif
|
#endif
|
||||||
const char *which = (CHKw(q, Show_CMDLIN)) ? *p->cmdline : p->cmd;
|
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);
|
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;
|
return buf;
|
||||||
} // end: forest_display
|
} // end: forest_display
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user