@@ -14,12 +14,13 @@ using namespace lsl;
1414
1515// / Substitute the "~" character by the full home directory (according to environment variables).
1616std::string expand_tilde (const std::string &filename) {
17+ // NOLINTBEGIN(concurrency-mt-unsafe)
1718 if (!filename.empty () && filename[0 ] == ' ~' ) {
1819 std::string homedir;
19- if (getenv (" HOME" ))
20- homedir = getenv ( " HOME " ) ;
21- else if (getenv (" USERPROFILE" ))
22- homedir = getenv ( " USERPROFILE " ) ;
20+ if (auto *home = getenv (" HOME" ))
21+ homedir = home ;
22+ else if (auto *home = getenv (" USERPROFILE" ))
23+ homedir = home ;
2324 else if (getenv (" HOMEDRIVE" ) && getenv (" HOMEPATH" ))
2425 homedir = std::string (getenv (" HOMEDRIVE" )) + getenv (" HOMEPATH" );
2526 else {
@@ -30,6 +31,7 @@ std::string expand_tilde(const std::string &filename) {
3031 return homedir + filename.substr (1 );
3132 }
3233 return filename;
34+ // NOLINTEND(concurrency-mt-unsafe)
3335}
3436
3537// / Parse a set specifier (a string of the form {a, b, c, ...}) into a vector of strings.
@@ -50,8 +52,10 @@ bool file_is_readable(const std::string &filename) {
5052api_config::api_config () {
5153 // for each config file location under consideration...
5254 std::vector<std::string> filenames;
53- if (getenv (" LSLAPICFG" )) {
54- std::string envcfg (getenv (" LSLAPICFG" ));
55+
56+ // NOLINTNEXTLINE(concurrency-mt-unsafe)
57+ if (auto cfgpath = getenv (" LSLAPICFG" )) {
58+ std::string envcfg (cfgpath);
5559 if (!file_is_readable (envcfg))
5660 LOG_F (ERROR, " LSLAPICFG file %s not found" , envcfg.c_str ());
5761 else
0 commit comments