diff --git a/src/plugin/Manager.cc b/src/plugin/Manager.cc index e4ee83dd83..8830cc9f65 100644 --- a/src/plugin/Manager.cc +++ b/src/plugin/Manager.cc @@ -63,7 +63,7 @@ void Manager::SearchDynamicPlugins(const std::string& dir) std::stringstream s(dir); std::string d; - while ( std::getline(s, d, path_list_separator) ) + while ( std::getline(s, d, path_list_separator[0]) ) SearchDynamicPlugins(d); return; diff --git a/src/util.cc b/src/util.cc index 5d0b9a8341..d62b05e304 100644 --- a/src/util.cc +++ b/src/util.cc @@ -71,7 +71,7 @@ static bool can_read(const string& path) } static string zeek_path_value; -const string zeek_path_list_separator(1, path_list_separator); +const string zeek_path_list_separator(path_list_separator.begin(), path_list_separator.end()); namespace zeek::util { @@ -576,7 +576,7 @@ void add_to_zeek_path(const string& dir) // Make sure path is initialized. zeek_path(); - zeek_path_value += string(zeek_path_list_separator) + dir; + zeek_path_value += zeek_path_list_separator + dir; } FILE* open_package(string& path, const string& mode) @@ -754,7 +754,7 @@ string without_zeekpath_component(std::string_view path) { string rval = normalize_path(path); - const auto paths = tokenize_string(zeek_path(), path_list_separator); + const auto paths = tokenize_string(zeek_path(), path_list_separator[0]); for ( size_t i = 0; i < paths.size(); ++i ) { diff --git a/src/util.h b/src/util.h index 5acb449df7..c7fa0ceab5 100644 --- a/src/util.h +++ b/src/util.h @@ -78,9 +78,9 @@ extern HeapLeakChecker* heap_checker; #endif #if defined(_MSC_VER) -const char path_list_separator = ';'; +inline constexpr std::string_view path_list_separator = ";"; #else -const char path_list_separator = ':'; +inline constexpr std::string_view path_list_separator = ":"; #endif extern "C"