More efficient string comparisions

This commit is contained in:
mkrsym1 2023-07-03 17:04:32 +03:00
parent 15f56c9e5a
commit ce427556a3
2 changed files with 3 additions and 3 deletions

View File

@ -31,5 +31,5 @@ uint32_t utils_file_crc32c(const char *filePath) {
char utils_env_enabled(const char *env) { char utils_env_enabled(const char *env) {
char *envText = getenv(env); char *envText = getenv(env);
return envText && strcmp(envText, "") != 0; return envText && *envText;
} }

View File

@ -42,7 +42,7 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
char *i = unixInjectDll, *w = unixWorkdir; char *i = unixInjectDll, *w = unixWorkdir;
char startsWith = 0; char startsWith = 0;
while (*i != '\0' && *w != '\0') { while (*i && *w) {
startsWith = *i == *w; startsWith = *i == *w;
if (!startsWith) break; if (!startsWith) break;
@ -95,7 +95,7 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
// Optional: wait for user input before resuming (useful for debugging) // Optional: wait for user input before resuming (useful for debugging)
char *waitEnabled = getenv("WAIT_BEFORE_RESUME"); char *waitEnabled = getenv("WAIT_BEFORE_RESUME");
if (waitEnabled && strcmp(waitEnabled, "") != 0) { if (waitEnabled && *waitEnabled) {
wchar_t message[64]; wchar_t message[64];
wsprintfW(message, L"PID: %ld. Press OK to continue", pi.dwProcessId); wsprintfW(message, L"PID: %ld. Press OK to continue", pi.dwProcessId);
MessageBoxW(NULL, message, J_MB_TITLE, MB_OK | MB_ICONINFORMATION); MessageBoxW(NULL, message, J_MB_TITLE, MB_OK | MB_ICONINFORMATION);