Commit ed0086bd authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Eliding four function calls by not comparing with an

empty string but checking for the terminating '\0'.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4949 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 505125e2
Showing with 6 additions and 4 deletions
+6 -4
2014-06-09 David Lawrence Ramsey <pooka109@gmail.com> 2014-06-09 David Lawrence Ramsey <pooka109@gmail.com>
* src/*.c: Cosmetic tweaks of comments and whitespace. * src/*.c: Cosmetic tweaks of comments and whitespace.
* src/help.c, src/rcfile.c, src/winio.c: Elide a function call by
not comparing with an empty string but checking for the final \0.
2014-06-09 Benno Schulenberg <bensberg@justemail.net> 2014-06-09 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (do_input): Remove two superfluous false conditions. * src/nano.c (do_input): Remove two superfluous false conditions.
......
...@@ -419,7 +419,7 @@ void help_init(void) ...@@ -419,7 +419,7 @@ void help_init(void)
if ((f->menus & currmenu) == 0) if ((f->menus & currmenu) == 0)
continue; continue;
if (!f->desc || !strcmp(f->desc, "")) if (!f->desc || f->desc[0] == '\0')
continue; continue;
/* Let's simply show the first two shortcuts from the list. */ /* Let's simply show the first two shortcuts from the list. */
......
...@@ -446,7 +446,7 @@ void parse_binding(char *ptr, bool dobind) ...@@ -446,7 +446,7 @@ void parse_binding(char *ptr, bool dobind)
funcptr = ptr; funcptr = ptr;
ptr = parse_next_word(ptr); ptr = parse_next_word(ptr);
if (!strcmp(funcptr, "")) { if (funcptr[0] == '\0') {
rcfile_error(N_("Must specify a function to bind the key to")); rcfile_error(N_("Must specify a function to bind the key to"));
return; return;
} }
...@@ -455,7 +455,7 @@ void parse_binding(char *ptr, bool dobind) ...@@ -455,7 +455,7 @@ void parse_binding(char *ptr, bool dobind)
menuptr = ptr; menuptr = ptr;
ptr = parse_next_word(ptr); ptr = parse_next_word(ptr);
if (!strcmp(menuptr, "")) { if (menuptr[0] == '\0') {
/* TRANSLATORS: Do not translate the word "all". */ /* TRANSLATORS: Do not translate the word "all". */
rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key")); rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key"));
return; return;
......
...@@ -2248,7 +2248,7 @@ void set_modified(void) ...@@ -2248,7 +2248,7 @@ void set_modified(void)
titlebar(NULL); titlebar(NULL);
#ifndef NANO_TINY #ifndef NANO_TINY
if (ISSET(LOCKING)) { if (ISSET(LOCKING)) {
if (!strcmp(openfile->filename, "")) if (openfile->filename[0] == '\0')
return; return;
else if (openfile->lock_filename == NULL) { else if (openfile->lock_filename == NULL) {
/* TRANSLATORS: Try to keep this at most 76 characters. */ /* TRANSLATORS: Try to keep this at most 76 characters. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment