From ce2eba1649f8ae2e9c2939c683f89d1b8f749ec8 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 6 Aug 2020 23:17:10 -0700 Subject: [PATCH] Fix inefficient baseDir non-empty check There's no need to call a string function and have function call overhead if you remember how C strings work: they have a null terminator. So if the first char in a string is a null terminator, then the string is completely empty. So you don't need to call that function. --- desktop_version/src/FileSystemUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 6f71f13d..d9ec2829 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -45,7 +45,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath) PHYSFS_permitSymbolicLinks(1); /* Determine the OS user directory */ - if (baseDir && strlen(baseDir) > 0) + if (baseDir && baseDir[0] != '\0') { strcpy(output, baseDir);