From edeb934cc32c235c03206bc9128266d550dfcf07 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 13 Aug 2006 13:27:16 +0200 Subject: [PATCH] try_mark_key: try to improve readability by using a local var and a cast The cast is not necessary since we already check the bounds, but by using a cast here, it hopefully makes it more obvious what the long comment above is pointing out: namely that we put the value of a signed integer into an unsigned char. --- src/viewer/text/view.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/viewer/text/view.c b/src/viewer/text/view.c index 14a287831..e16847e67 100644 --- a/src/viewer/text/view.c +++ b/src/viewer/text/view.c @@ -637,6 +637,7 @@ enum frame_event_status try_mark_key(struct session *ses, struct document_view *doc_view, struct term_event *ev) { + term_event_key_T key = get_kbd_key(ev); unsigned char mark; /* set_mark and goto_mark allow only a subset of the ASCII @@ -646,8 +647,8 @@ try_mark_key(struct session *ses, struct document_view *doc_view, * will not accept, so the results are consistent. * When CONFIG_UTF_8 is not defined, this assumes that codes * 0 to 0x7F in all codepages match ASCII. */ - if (get_kbd_key(ev) >= 0 && get_kbd_key(ev) <= 0x7F) - mark = get_kbd_key(ev); + if (key >= 0 && key <= 0x7F) + mark = (unsigned char) key; else mark = 0;