From 2f33945bb1a0aac5bcb8fa78f4ddcceb9f1c241f Mon Sep 17 00:00:00 2001 From: Steffen Nurpmeso Date: Mon, 19 Feb 2018 17:10:22 +0100 Subject: [PATCH] a_tty_hist_load(): drop unused variable --- tty.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tty.c b/tty.c index d6838436..3cc2fca3 100644 --- a/tty.c +++ b/tty.c @@ -999,7 +999,7 @@ static bool_t a_tty_hist_load(void){ ui8_t version; size_t lsize, cnt, llen; - char *lbuf, esc, *cp; + char *lbuf, *cp; FILE *f; char const *v; bool_t rv; @@ -1039,7 +1039,6 @@ a_tty_hist_load(void){ assert(!(n_pstate & n_PS_ROOT)); n_pstate |= n_PS_ROOT; /* Allow calling addhist() */ lbuf = NULL; - n_UNINIT(esc, '\0'); lsize = 0; cnt = (size_t)fsize(f); version = 0; @@ -1058,16 +1057,9 @@ a_tty_hist_load(void){ if(llen == 0 || cp[0] == '#') continue; - if(n_UNLIKELY(version == 0)){ - switch((version = strcmp(cp, a_TTY_HIST_MARKER) ? 1 : 2)){ - case 1: - if((esc = ok_vlook(escape)[0]) == '\0') - esc = n_ESCAPE[0]; - break; - default: - continue; - } - } + if(n_UNLIKELY(version == 0) && + (version = strcmp(cp, a_TTY_HIST_MARKER) ? 1 : 2) != 1) + continue; /* C99 */{ enum n_go_input_flags gif; @@ -2584,7 +2576,9 @@ a_tty__khist_shared(struct a_tty_line *tlp, struct a_tty_hist *thp){ } tlp->tl_defc.s = cp = n_autorec_alloc(i +1); if(tlp->tl_goinflags & n_GO_INPUT_CTX_COMPOSE){ - *cp++ = ok_vlook(escape)[0]; /* Do not care whether \0 == disabled! */ + if((*cp = ok_vlook(escape)[0]) == '\0') + *cp = n_ESCAPE[0]; + ++cp; if(!(thp->th_flags & a_TTY_HIST_CTX_COMPOSE)) *cp++ = ':'; } -- 2.11.4.GIT