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

tweaks: don't call strcmp() to determine whether a string is empty

No related merge requests found
Showing with 2 additions and 2 deletions
+2 -2
...@@ -435,7 +435,7 @@ bool open_buffer(const char *filename, bool undoable) ...@@ -435,7 +435,7 @@ bool open_buffer(const char *filename, bool undoable)
/* When the specified filename is not empty, and the corresponding /* When the specified filename is not empty, and the corresponding
* file exists, verify that it is a normal file. */ * file exists, verify that it is a normal file. */
if (strcmp(filename, "") != 0) { if (*filename != '\0') {
struct stat fileinfo; struct stat fileinfo;
if (stat(realname, &fileinfo) == 0 && !(S_ISREG(fileinfo.st_mode) || if (stat(realname, &fileinfo) == 0 && !(S_ISREG(fileinfo.st_mode) ||
......
...@@ -48,7 +48,7 @@ void get_homedir(void) ...@@ -48,7 +48,7 @@ void get_homedir(void)
/* Only set homedir if some home directory could be determined, /* Only set homedir if some home directory could be determined,
* otherwise keep homedir NULL. */ * otherwise keep homedir NULL. */
if (homenv != NULL && strcmp(homenv, "") != 0) if (homenv != NULL && *homenv != '\0')
homedir = mallocstrcpy(NULL, homenv); homedir = mallocstrcpy(NULL, homenv);
} }
} }
......
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