diff options
author | Håvard Pettersen <havardpe@oath.com> | 2021-09-02 13:29:00 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2021-09-02 13:29:00 +0000 |
commit | 29862b387bf5451c0936e7c00a458193154d5e4f (patch) | |
tree | 2229b50a60b6d773f2698b8db68b2a9540ae9f46 /eval | |
parent | 42d0ef76316ec72775a5922639550c728e24ee77 (diff) |
use common history event
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/apps/eval_expr/eval_expr.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/eval/src/apps/eval_expr/eval_expr.cpp b/eval/src/apps/eval_expr/eval_expr.cpp index 248a2abf9a0..60040a175c7 100644 --- a/eval/src/apps/eval_expr/eval_expr.cpp +++ b/eval/src/apps/eval_expr/eval_expr.cpp @@ -215,17 +215,17 @@ bool is_only_whitespace(const vespalib::string &str) { struct EditLineWrapper { EditLine *my_el; History *my_hist; + HistEvent ignore; static vespalib::string prompt; static char *prompt_fun(EditLine *) { return &prompt[0]; } EditLineWrapper() : my_el(el_init("vespa-eval-expr", stdin, stdout, stderr)), my_hist(history_init()) { + memset(&ignore, 0, sizeof(ignore)); el_set(my_el, EL_EDITOR, "emacs"); el_set(my_el, EL_PROMPT, prompt_fun); - HistEvent evt; - memset(&evt, 0, sizeof(evt)); - history(my_hist, &evt, H_SETSIZE, 1024); + history(my_hist, &ignore, H_SETSIZE, 1024); el_set(my_el, EL_HIST, history, my_hist); } ~EditLineWrapper(); @@ -241,9 +241,7 @@ struct EditLineWrapper { line_out.pop_back(); } } while (is_only_whitespace(line_out)); - HistEvent evt; - memset(&evt, 0, sizeof(evt)); - history(my_hist, &evt, H_ENTER, line_out.c_str()); + history(my_hist, &ignore, H_ENTER, line_out.c_str()); return true; } }; |