From d3012be095f3e943458eb2e33452972b154bc760 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 6 Mar 2018 11:59:03 +0100 Subject: [PATCH] tweaks: don't call strcmp() to determine whether a string is empty --- src/files.c | 2 +- src/utils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/files.c b/src/files.c index e6fe1fb6..48b7bb1d 100644 --- a/src/files.c +++ b/src/files.c @@ -435,7 +435,7 @@ bool open_buffer(const char *filename, bool undoable) /* When the specified filename is not empty, and the corresponding * file exists, verify that it is a normal file. */ - if (strcmp(filename, "") != 0) { + if (*filename != '\0') { struct stat fileinfo; if (stat(realname, &fileinfo) == 0 && !(S_ISREG(fileinfo.st_mode) || diff --git a/src/utils.c b/src/utils.c index 00849c81..91f279a4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -48,7 +48,7 @@ void get_homedir(void) /* Only set homedir if some home directory could be determined, * otherwise keep homedir NULL. */ - if (homenv != NULL && strcmp(homenv, "") != 0) + if (homenv != NULL && *homenv != '\0') homedir = mallocstrcpy(NULL, homenv); } }