From 10f880c62f637781c9ce37c1b6066674c152b1d0 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 29 Apr 2005 03:24:43 +0000 Subject: [PATCH] remove a redundant check in get_history_newer(), and add a few comment fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2493 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/search.c | 3 +-- src/winio.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 281c288e..57a86740 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,9 @@ CVS code - do_output() - Properly allow wrapping when we insert a tab, for consistency. (DLR) +- search.c: + get_history_newer() + - Remove redundant check. (DLR) - utils.c: num_of_digits() - Use a size_t instead of an int, and rename to digits(). (DLR) diff --git a/src/search.c b/src/search.c index 696e2349..4288f789 100644 --- a/src/search.c +++ b/src/search.c @@ -1215,8 +1215,7 @@ char *get_history_newer(historyheadtype *h) { if (h->current->prev != NULL) { h->current = h->current->prev; - if (h->current->prev != NULL) - return h->current->data; + return h->current->data; } return NULL; } diff --git a/src/winio.c b/src/winio.c index bf589376..e4bb525f 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2450,12 +2450,12 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, char *complete = NULL; int last_kbinput = 0; - /* This variable is used in the search history code. use_cb == 0 - means that we're using the existing history and ignoring - currentbuf. use_cb == 1 means that the entry in answer should be - moved to currentbuf or restored from currentbuf to answer. - use_cb == 2 means that the entry in currentbuf should be moved to - answer or restored from answer to currentbuf. */ + /* This variable is used in the search history code. use_cb == 0 + * means that we're using the existing history and ignoring + * currentbuf. use_cb == 1 means that the entry in answer should be + * moved to currentbuf or restored from currentbuf to answer. + * use_cb == 2 means that the entry in currentbuf should be moved to + * answer or restored from answer to currentbuf. */ int use_cb = 0; #endif @@ -2478,7 +2478,8 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, nanoget_repaint(buf, answer, statusbar_x); - /* Refresh the edit window before getting input. */ + /* Refresh the edit window and the statusbar before getting + * input. */ wnoutrefresh(edit); wrefresh(bottomwin); @@ -2599,7 +2600,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def, free(currentbuf); currentbuf = NULL; use_cb = 1; - /* Itherwise, if currentbuf is NULL and use_cb isn't + /* Otherwise, if currentbuf is NULL and use_cb isn't * 2, it means that we're scrolling down at the * bottom of the search history and the current * answer (if it's not blank) needs to be saved in -- 2.39.5