Skip to content

Use string_split in set_classpath #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions src/util/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Author: Daniel Kroening, [email protected]
#include "std_expr.h"
#include "cprover_prefix.h"
#include "string2int.h"
#include "string_utils.h"

configt config;

Expand Down Expand Up @@ -1286,31 +1287,18 @@ irep_idt configt::this_architecture()

void configt::set_classpath(const std::string &cp)
{
std::string current;
for(std::size_t pos=0; pos<cp.size(); pos++)
{
// These are separated by colons on Unix, and semicolons on
// Windows.
#ifdef _WIN32
const char cp_separator=';';
#else
const char cp_separator=':';
#endif

if(cp[pos]==cp_separator)
{
if(!current.empty())
{
java.classpath.push_back(current);
current.clear();
}
}
else
current+=cp[pos];
}

if(!current.empty())
java.classpath.push_back(current);
// These are separated by colons on Unix, and semicolons on
// Windows.
#ifdef _WIN32
const char cp_separator = ';';
#else
const char cp_separator = ':';
#endif

std::vector<std::string> class_path;
split_string(cp, cp_separator, class_path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick: typo in commit message (it currently says "string_split")

java.classpath.insert(
java.classpath.end(), class_path.begin(), class_path.end());
}

irep_idt configt::this_operating_system()
Expand Down