top: again avoid multiple evaluation of macro argument

Before top was modified to exploit the new <pids> api,
there was protection in that task_show() makeVAR macro
to avoid multiple evaluation of this macro's argument.

But, in that commit referenced below, such a safeguard
was lost. This commit simply restores proper behavior.

Reference(s);
. offending change
commit 77dc22b910

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2017-10-03 00:00:00 -05:00 committed by Craig Small
parent e55016def5
commit 53a1b9650b

View File

@ -5072,8 +5072,9 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
// a tailored 'results stack value' extractor macro
#define rSv(E,T) PID_VAL(E, T, p)
#ifndef SCROLLVAR_NO
#define makeVAR(S) { if (!q->varcolbeg) cp = make_str(S, q->varcolsz, Js, AUTOX_NO); \
else cp = make_str(q->varcolbeg < (int)strlen(S) ? S + q->varcolbeg : "", q->varcolsz, Js, AUTOX_NO); }
#define makeVAR(S) { const char *pv = S; \
if (!q->varcolbeg) cp = make_str(pv, q->varcolsz, Js, AUTOX_NO); \
else cp = make_str(q->varcolbeg < (int)strlen(pv) ? pv + q->varcolbeg : "", q->varcolsz, Js, AUTOX_NO); }
#define varUTF8(S) { const char *pv = S; \
if (!q->varcolbeg) cp = make_str_utf8(pv, q->varcolsz, Js, AUTOX_NO); \
else cp = make_str_utf8((q->varcolbeg < ((int)strlen(pv) - utf8_delta(pv))) \