From a93f23e6ef5ce3ecade10352e61d5b1e2261f68a Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 23 Dec 2012 00:00:00 -0600 Subject: [PATCH] top: place inspect demo buffer on par with read buffer Both of the 'file' and 'pipe' Inspect read buffers are always 2048 bytes bigger than is actually needed which provided for some slightly simplified row paint logic. However, with no real rcfile inspect entries, and thus operating in 'demo' mode, the allocated buffer is only 2048 bytes total. This can produce a valgrind warning. This commit simply puts the inspect 'demo' buffer on a par with other allocated real buffers (an extra 2048). (everything is perfectly justified plus right margins) (are completely filled, but of course it must be luck) Signed-off-by: Jim Warner --- top/top.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/top/top.c b/top/top.c index 97fc5fc6..f9ece85e 100644 --- a/top/top.c +++ b/top/top.c @@ -2501,8 +2501,10 @@ static void insp_cnt_nl (void) { * The pseudo output DEMO utility. */ static void insp_do_demo (char *fmts, int pid) { (void)fmts; (void)pid; - Insp_bufsz = READMINSZ; - Insp_buf = alloc_c(READMINSZ); + /* next will put us on a par with the real file/pipe read buffers + ( and also avoid a harmless, but evil sounding, valgrind warning ) */ + Insp_bufsz = READMINSZ + strlen(N_txt(YINSP_dstory_txt)); + Insp_buf = alloc_c(Insp_bufsz); Insp_bufrd = snprintf(Insp_buf, Insp_bufsz, "%s", N_txt(YINSP_dstory_txt)); insp_cnt_nl(); } // end: insp_do_demo