mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 12:51:23 +03:00
tweaks: more consistently use * instead of [0] when checking for '\0'
This commit is contained in:
parent
2fae87d9a5
commit
1d3d30776a
@ -681,7 +681,7 @@ int filesearch_init(void)
|
|||||||
int input;
|
int input;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (last_search[0] != '\0') {
|
if (*last_search != '\0') {
|
||||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||||
|
|
||||||
buf = charalloc(strlen(disp) + 7);
|
buf = charalloc(strlen(disp) + 7);
|
||||||
@ -787,9 +787,8 @@ void do_filesearch(void)
|
|||||||
last_search = mallocstrcpy(last_search, answer);
|
last_search = mallocstrcpy(last_search, answer);
|
||||||
|
|
||||||
#ifndef DISABLE_HISTORIES
|
#ifndef DISABLE_HISTORIES
|
||||||
/* If answer is not "", add this search string to the search history
|
/* If answer is not empty, add the string to the search history list. */
|
||||||
* list. */
|
if (*answer != '\0')
|
||||||
if (answer[0] != '\0')
|
|
||||||
update_history(&search_history, answer);
|
update_history(&search_history, answer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -798,10 +797,10 @@ void do_filesearch(void)
|
|||||||
bottombars(MBROWSER);
|
bottombars(MBROWSER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for the last given filename again without prompting. */
|
/* Search again for the last given filename, without prompting. */
|
||||||
void do_fileresearch(void)
|
void do_fileresearch(void)
|
||||||
{
|
{
|
||||||
if (last_search[0] == '\0')
|
if (*last_search == '\0')
|
||||||
statusbar(_("No current search pattern"));
|
statusbar(_("No current search pattern"));
|
||||||
else
|
else
|
||||||
findnextfile(last_search);
|
findnextfile(last_search);
|
||||||
|
@ -629,7 +629,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
|||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
/* If we're scrolling up at the bottom of the history list
|
/* If we're scrolling up at the bottom of the history list
|
||||||
* and answer isn't blank, save answer in magichistory. */
|
* and answer isn't blank, save answer in magichistory. */
|
||||||
if ((*history_list)->next == NULL && answer[0] != '\0')
|
if ((*history_list)->next == NULL && *answer != '\0')
|
||||||
magichistory = mallocstrcpy(magichistory, answer);
|
magichistory = mallocstrcpy(magichistory, answer);
|
||||||
|
|
||||||
/* Get the older search from the history list and save it in
|
/* Get the older search from the history list and save it in
|
||||||
|
@ -142,7 +142,7 @@ int search_init(bool replacing, bool use_answer)
|
|||||||
* do_search() or do_replace() and be called again. In that case,
|
* do_search() or do_replace() and be called again. In that case,
|
||||||
* we should put the same search string back up. */
|
* we should put the same search string back up. */
|
||||||
|
|
||||||
if (last_search[0] != '\0') {
|
if (*last_search != '\0') {
|
||||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||||
|
|
||||||
buf = charalloc(strlen(disp) + 7);
|
buf = charalloc(strlen(disp) + 7);
|
||||||
@ -465,11 +465,11 @@ void do_research(void)
|
|||||||
#ifndef DISABLE_HISTORIES
|
#ifndef DISABLE_HISTORIES
|
||||||
/* If nothing was searched for yet during this run of nano, but
|
/* If nothing was searched for yet during this run of nano, but
|
||||||
* there is a search history, take the most recent item. */
|
* there is a search history, take the most recent item. */
|
||||||
if (last_search[0] == '\0' && searchbot->prev != NULL)
|
if (*last_search == '\0' && searchbot->prev != NULL)
|
||||||
last_search = mallocstrcpy(last_search, searchbot->prev->data);
|
last_search = mallocstrcpy(last_search, searchbot->prev->data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (last_search[0] == '\0') {
|
if (*last_search == '\0') {
|
||||||
statusbar(_("No current search pattern"));
|
statusbar(_("No current search pattern"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user