Skip to content

remove deprecated split_string variant #5340

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
May 13, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions src/memory-analyzer/memory_analyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ int memory_analyzer_parse_optionst::doit()
std::string binary = cmdline.args.front();

const std::string symbol_list(cmdline.get_value("symbols"));
std::vector<std::string> result;
split_string(symbol_list, ',', result, true, true);
std::vector<std::string> result = split_string(symbol_list, ',', true, true);

auto opt = read_goto_binary(binary, ui_message_handler);

Expand Down
3 changes: 1 addition & 2 deletions src/util/string_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ void split_string(
// delim can't be a space character if using strip
PRECONDITION(!std::isspace(delim) || !strip);

std::vector<std::string> result;
std::vector<std::string> result = split_string(s, delim, strip);

split_string(s, delim, result, strip);
if(result.size() != 2)
{
throw deserialization_exceptiont{"expected string '" + s +
Expand Down
27 changes: 7 additions & 20 deletions src/util/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,22 @@ std::string strip_string(const std::string &s);

std::string capitalize(const std::string &str);

void split_string(
const std::string &s,
char delim,
std::string &left,
std::string &right,
bool strip = false);

/// Given a string s, split into a sequence of substrings when separated by
/// specified delimiter.
/// \param s: The string to split up
/// \param delim: The character to use as the delimiter
/// \param [out] result: The sub strings. Must be empty.
/// \param strip: If true, strip_string will be used on each element, removing
/// whitespace from the beginning and end of each element
/// \param remove_empty: If true, all empty-string elements will be removed.
/// This is applied after strip so whitespace only elements will be removed if
/// both are set to true.
DEPRECATED(SINCE(
2019,
11,
14,
"use split_string(s, delim, strip, remove_empty) instead"))
void split_string(
const std::string &s,
char delim,
std::vector<std::string> &result,
bool strip = false,
bool remove_empty = false);

void split_string(
const std::string &s,
char delim,
std::string &left,
std::string &right,
bool strip=false);

std::vector<std::string> split_string(
const std::string &s,
char delim,
Expand Down