From ed0086bde52a1d6727b88f214f13fbee7e9463b0 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 9 Jun 2014 14:33:00 +0000
Subject: [PATCH] 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
---
 ChangeLog    | 2 ++
 src/help.c   | 2 +-
 src/rcfile.c | 4 ++--
 src/winio.c  | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0d2e57dc..23f5b482 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-06-09  David Lawrence Ramsey  <pooka109@gmail.com>
 	* 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>
 	* src/nano.c (do_input): Remove two superfluous false conditions.
diff --git a/src/help.c b/src/help.c
index ea6b9241..3ec70b81 100644
--- a/src/help.c
+++ b/src/help.c
@@ -419,7 +419,7 @@ void help_init(void)
 	if ((f->menus & currmenu) == 0)
 	    continue;
 
-	if (!f->desc || !strcmp(f->desc, ""))
+	if (!f->desc || f->desc[0] == '\0')
 	    continue;
 
 	/* Let's simply show the first two shortcuts from the list. */
diff --git a/src/rcfile.c b/src/rcfile.c
index 99c3c45f..1c6720f9 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -446,7 +446,7 @@ void parse_binding(char *ptr, bool dobind)
 	funcptr = 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"));
 	    return;
 	}
@@ -455,7 +455,7 @@ void parse_binding(char *ptr, bool dobind)
     menuptr = ptr;
     ptr = parse_next_word(ptr);
 
-    if (!strcmp(menuptr, "")) {
+    if (menuptr[0] == '\0') {
 	/* TRANSLATORS: Do not translate the word "all". */
 	rcfile_error(N_("Must specify a menu (or \"all\") in which to bind/unbind the key"));
 	return;
diff --git a/src/winio.c b/src/winio.c
index 0e282d2c..7259ad39 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2248,7 +2248,7 @@ void set_modified(void)
 	titlebar(NULL);
 #ifndef NANO_TINY
 	if (ISSET(LOCKING)) {
-	    if (!strcmp(openfile->filename, ""))
+	    if (openfile->filename[0] == '\0')
 		return;
 	    else if (openfile->lock_filename == NULL) {
                 /* TRANSLATORS: Try to keep this at most 76 characters. */
-- 
GitLab