From: Benno Schulenberg Date: Sun, 22 Jun 2014 21:21:00 +0000 (+0000) Subject: Removing a superfluous abortion variable, and placing two comments better. X-Git-Tag: v2.3.5~49 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=64039e9337dfd5fd49e7b5cf00723b9b7e3795de;p=nano.git Removing a superfluous abortion variable, and placing two comments better. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5011 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index e5109425..2613bb02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Remove two pointless calls of get_shortcut(), and adjust the comments. * src/nano.c (do_toggle): When toggling softwrap, only the edit window needs to be refreshed, not the entire screen. + * src/browser.c (do_browser): Remove superfluous abortion variable, + and place two comments better. 2014-06-22 Mark Majeres * src/text.c (do_redo): When redoing a line join at the tail diff --git a/src/browser.c b/src/browser.c index 9fb30d90..21b7375f 100644 --- a/src/browser.c +++ b/src/browser.c @@ -51,8 +51,6 @@ char *do_browser(char *path, DIR *dir) char *retval = NULL; int kbinput; bool meta_key, func_key, old_const_update = ISSET(CONST_UPDATE); - bool abort = FALSE; - /* Whether we should abort the file browser. */ char *prev_dir = NULL; /* The directory we were in, if any, before backing up via * browsing to "..". */ @@ -108,7 +106,7 @@ char *do_browser(char *path, DIR *dir) titlebar(path); - while (!abort) { + while (TRUE) { struct stat st; int i; size_t fileline = selected / width; @@ -321,16 +319,15 @@ char *do_browser(char *path, DIR *dir) continue; } - /* If we've successfully opened a file, we're done, so - * get out. */ if (!S_ISDIR(st.st_mode)) { + /* We've successfully opened a file, we're done, so + * get out. */ retval = mallocstrcpy(NULL, filelist[selected]); - abort = TRUE; - continue; - /* If we've successfully opened a directory, and it's - * "..", save the current directory in prev_dir, so that - * we can easily return to it by hitting Enter. */ + break; } else if (strcmp(tail(filelist[selected]), "..") == 0) + /* We've successfully opened the parent directory, + * save the current directory in prev_dir, so that + * we can easily return to it by hitting Enter. */ prev_dir = mallocstrcpy(NULL, striponedir(filelist[selected])); dir = opendir(filelist[selected]); @@ -348,8 +345,8 @@ char *do_browser(char *path, DIR *dir) /* Start over again with the new path value. */ goto change_browser_directory; } else if (f->scfunc == do_exit) { - /* Abort the file browser. */ - abort = TRUE; + /* Exit from the file browser. */ + break; } } titlebar(NULL);