From: David Lawrence Ramsey Date: Sun, 1 Jul 2007 21:33:17 +0000 (+0000) Subject: more cosmetic fixes X-Git-Tag: v2.0.7~81 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=86c163f087d60b30d32e9b083ec286ed2ff980b3;p=nano.git more cosmetic fixes git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_0_branch/nano@4120 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/browser.c b/src/browser.c index b04c3662..b7ae2b7e 100644 --- a/src/browser.c +++ b/src/browser.c @@ -227,7 +227,7 @@ char *do_browser(char *path, DIR *dir) /* If the directory begins with a newline (i.e. an * encoded null), treat it as though it's blank. */ - if (i < 0 || answer[0] == '\n') { + if (i < 0 || *answer == '\n') { /* We canceled. Indicate that on the statusbar, and * blank out ans, since we're done with it. */ statusbar(_("Cancelled")); @@ -827,8 +827,8 @@ int filesearch_init(void) backupstring = NULL; /* Cancel any search, or just return with no previous search. */ - if (i == -1 || (i < 0 && last_search[0] == '\0') || - (i == 0 && answer[0] == '\0')) { + if (i == -1 || (i < 0 && *last_search == '\0') || (i == 0 && + *answer == '\0')) { statusbar(_("Cancelled")); return -1; } else { @@ -983,7 +983,7 @@ void do_filesearch(void) return; /* If answer is now "", copy last_search into answer. */ - if (answer[0] == '\0') + if (*answer == '\0') answer = mallocstrcpy(answer, last_search); else last_search = mallocstrcpy(last_search, answer); diff --git a/src/files.c b/src/files.c index 74fbeafa..350c4362 100644 --- a/src/files.c +++ b/src/files.c @@ -741,7 +741,7 @@ void do_insertfile( * blank, open a new buffer instead of canceling. If the * filename or command begins with a newline (i.e. an encoded * null), treat it as though it's blank. */ - if (i == -1 || ((i == -2 || answer[0] == '\n') + if (i == -1 || ((i == -2 || *answer == '\n') #ifdef ENABLE_MULTIBUFFER && !ISSET(MULTIBUFFER) #endif @@ -1307,7 +1307,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type assert(name != NULL); - if (name[0] == '\0') + if (*name == '\0') return -1; if (f_open != NULL) @@ -1408,7 +1408,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type sprintf(backupname, "%s%s", backup_dir, backuptemp); free(backuptemp); backuptemp = get_next_filename(backupname, "~"); - if (backuptemp[0] == '\0') { + if (*backuptemp == '\0') { statusbar(_("Error writing %s: %s"), backupname, _("Too many backup files?")); free(backuptemp); @@ -1833,7 +1833,7 @@ bool do_writeout(bool exiting) /* If the filename or command begins with a newline (i.e. an * encoded null), treat it as though it's blank. */ - if (i < 0 || answer[0] == '\n') { + if (i < 0 || *answer == '\n') { statusbar(_("Cancelled")); retval = FALSE; break; @@ -1993,7 +1993,7 @@ char *real_dir_from_tilde(const char *buf) assert(buf != NULL); - if (buf[0] == '~') { + if (*buf == '~') { size_t i = 1; char *tilde_dir; @@ -2255,7 +2255,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool /* If the word starts with `~' and there is no slash in the word, * then try completing this word as a username. */ - if (*place > 0 && buf[0] == '~') { + if (*place > 0 && *buf == '~') { const char *bob = strchr(buf, '/'); if (bob == NULL || bob >= buf + *place) diff --git a/src/nano.c b/src/nano.c index 59d498c1..2d7b0937 100644 --- a/src/nano.c +++ b/src/nano.c @@ -608,7 +608,7 @@ void die_save_file(const char *die_filename) /* If we can't save, we have really bad problems, but we might as * well try. */ - if (die_filename[0] == '\0') + if (*die_filename == '\0') die_filename = "nano"; retval = get_next_filename(die_filename, ".save"); diff --git a/src/prompt.c b/src/prompt.c index 06b2b6a6..336f168f 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -1077,7 +1077,7 @@ int get_prompt_string(bool allow_tabs, * magichistory is set, save magichistory in * answer. */ if ((*history_list)->next == NULL && - answer[0] == '\0' && magichistory != NULL) { + *answer == '\0' && magichistory != NULL) { answer = mallocstrcpy(answer, magichistory); statusbar_x = strlen(answer); } @@ -1221,7 +1221,7 @@ int do_prompt(bool allow_tabs, retval = -1; break; case NANO_ENTER_KEY: - retval = (answer[0] == '\0') ? -2 : 0; + retval = (*answer == '\0') ? -2 : 0; break; } diff --git a/src/search.c b/src/search.c index f90908ed..a1e5d644 100644 --- a/src/search.c +++ b/src/search.c @@ -208,8 +208,8 @@ int search_init(bool replacing, bool use_answer) backupstring = NULL; /* Cancel any search, or just return with no previous search. */ - if (i == -1 || (i < 0 && last_search[0] == '\0') || - (!replacing && i == 0 && answer[0] == '\0')) { + if (i == -1 || (i < 0 && *last_search == '\0') || (!replacing && + i == 0 && *answer == '\0')) { statusbar(_("Cancelled")); return -1; } else { @@ -444,7 +444,7 @@ void do_search(void) return; /* If answer is now "", copy last_search into answer. */ - if (answer[0] == '\0') + if (*answer == '\0') answer = mallocstrcpy(answer, last_search); else last_search = mallocstrcpy(last_search, answer); diff --git a/src/winio.c b/src/winio.c index 1fbb19d0..e0591ee2 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2189,7 +2189,7 @@ void titlebar(const char *path) state = openfile->modified ? _("Modified") : ISSET(VIEW_MODE) ? _("View") : ""; - statelen = strlenpt((state[0] == '\0' && path == NULL) ? + statelen = strlenpt((*state == '\0' && path == NULL) ? _("Modified") : state); /* If possible, add a space before state. */