Skip to content

Commit

Permalink
Use Strings::EMPTY
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkaratarakis committed Aug 29, 2017
1 parent 03c4c7f commit 28e5815
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions toolsrc/src/SourceParagraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ namespace vcpkg
{
return Util::fmap(depends, [&](const std::string& depend_string) -> Dependency {
auto pos = depend_string.find(' ');
if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, "");
if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, Strings::EMPTY);
// expect of the form "\w+ \[\w+\]"
Dependency dep;

dep.depend.name = depend_string.substr(0, pos);
if (depend_string.c_str()[pos + 1] != '(' || depend_string[depend_string.size() - 1] != ')')
{
// Error, but for now just slurp the entire string.
return Dependency::parse_dependency(depend_string, "");
return Dependency::parse_dependency(depend_string, Strings::EMPTY);
}
dep.qualifier = depend_string.substr(pos + 2, depend_string.size() - pos - 3);
return dep;
Expand Down
6 changes: 3 additions & 3 deletions toolsrc/src/VcpkgCmdArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ namespace vcpkg

void VcpkgCmdArguments::check_max_arg_count(const size_t expected_arg_count) const
{
return check_max_arg_count(expected_arg_count, "");
return check_max_arg_count(expected_arg_count, Strings::EMPTY);
}

void VcpkgCmdArguments::check_min_arg_count(const size_t expected_arg_count) const
{
return check_min_arg_count(expected_arg_count, "");
return check_min_arg_count(expected_arg_count, Strings::EMPTY);
}

void VcpkgCmdArguments::check_exact_arg_count(const size_t expected_arg_count) const
{
return check_exact_arg_count(expected_arg_count, "");
return check_exact_arg_count(expected_arg_count, Strings::EMPTY);
}

void VcpkgCmdArguments::check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/VcpkgPaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace vcpkg
fs::path get_nuget_path(const fs::path& downloads_folder, const fs::path& scripts_folder)
{
static constexpr std::array<int, 3> expected_version = {4, 1, 0};
static const std::wstring version_check_arguments = L"";
static const std::wstring version_check_arguments = Strings::WEMPTY;

const fs::path downloaded_copy = downloads_folder / "nuget-4.1.0" / "nuget.exe";
const std::vector<fs::path> from_path = find_from_PATH(L"nuget");
Expand Down
8 changes: 4 additions & 4 deletions toolsrc/src/vcpkg_Build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace vcpkg::Build

CWStringView to_vcvarsall_target(const std::string& cmake_system_name)
{
if (cmake_system_name == "") return L"";
if (cmake_system_name == "Windows") return L"";
if (cmake_system_name == Strings::EMPTY) return Strings::WEMPTY;
if (cmake_system_name == "Windows") return Strings::WEMPTY;
if (cmake_system_name == "WindowsStore") return L"store";

Checks::exit_with_message(VCPKG_LINE_INFO, "Unsupported vcvarsall target %s", cmake_system_name);
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace vcpkg::Build
const wchar_t* tonull = L" >nul";
if (GlobalState::debugging)
{
tonull = L"";
tonull = Strings::WEMPTY;
}

const auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset);
Expand Down Expand Up @@ -359,7 +359,7 @@ namespace vcpkg::Build

const bool variable_with_no_value = s.size() == 1;
const std::string variable_name = s.at(0);
const std::string variable_value = variable_with_no_value ? "" : s.at(1);
const std::string variable_value = variable_with_no_value ? Strings::EMPTY : s.at(1);

if (variable_name == "VCPKG_TARGET_ARCHITECTURE")
{
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg_Checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace vcpkg::Checks
{
if (!expression)
{
exit_with_message(line_info, "");
exit_with_message(line_info, Strings::EMPTY);
}
}

Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg_Parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace vcpkg::Parse
}
std::string ParagraphParser::optional_field(const std::string& fieldname)
{
return remove_field(&fields, fieldname).value_or("");
return remove_field(&fields, fieldname).value_or(Strings::EMPTY);
}
std::unique_ptr<ParseControlErrorInfo> ParagraphParser::error_info(const std::string& name) const
{
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg_Strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace vcpkg::Strings
trim(&s);
}

Util::erase_remove_if(*strings, [](const std::string& s) { return s == ""; });
Util::erase_remove_if(*strings, [](const std::string& s) { return Strings::is_empty(s); });
}

std::vector<std::string> split(const std::string& s, const std::string& delimiter)
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkglib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace vcpkg

for (const std::unique_ptr<StatusParagraph>& pgh : status_db)
{
if (pgh->state != InstallState::INSTALLED || pgh->package.feature != "")
if (pgh->state != InstallState::INSTALLED || !Strings::is_empty(pgh->package.feature))
{
continue;
}
Expand Down

0 comments on commit 28e5815

Please sign in to comment.