diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp index c5b044db68..5daad90ff4 100644 --- a/src/stratagus/stratagus.cpp +++ b/src/stratagus/stratagus.cpp @@ -212,6 +212,7 @@ extern void beos_init(int argc, char **argv); #include #include +#include #ifdef USE_STACKTRACE #include @@ -590,11 +591,8 @@ void ParseCommandLine(int argc, char **argv, Parameters ¶meters) RefreshRate = to_number(optarg); continue; case 'u': - if (!strcmp(optarg, "userhome")) { - Parameters::Instance.SetUserDirectory(""); - } else { - Parameters::Instance.SetUserDirectory(optarg); - } + Parameters::Instance.SetUserDirectory( + optarg == std::string_view("userhome") ? "" : optarg); continue; case 'v': { sep = strchr(optarg, 'x'); diff --git a/src/stratagus/util.cpp b/src/stratagus/util.cpp index 623bbfab09..19099deec1 100644 --- a/src/stratagus/util.cpp +++ b/src/stratagus/util.cpp @@ -341,6 +341,7 @@ int to_number(std::string_view s, int base) */ #include +#include int opterr = 1; int optind = 1; @@ -371,7 +372,7 @@ int getopt(int argc, char *const *argv, const char *opts) noexcept if (sp == 1) { if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') { return EOF; - } else if (!strcmp(argv[optind], "--")) { + } else if (argv[optind] == std::string_view("--")) { optind++; return EOF; }