[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] Rename misleading remove_trailing_white_spaces functions
Trailing implies only whitespace at the end is removed, but these
functions also remove leading whitespace.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
---
include/abg-tools-utils.h | 2 +-
src/abg-ini.cc | 13 +++++--------
src/abg-tools-utils.cc | 7 +++----
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/include/abg-tools-utils.h b/include/abg-tools-utils.h
index defc7ba..2e59256 100644
--- a/include/abg-tools-utils.h
+++ b/include/abg-tools-utils.h
@@ -71,7 +71,7 @@ string get_library_version_string();
bool execute_command_and_get_output(const string&, vector<string>&);
bool get_dsos_provided_by_rpm(const string& rpm_path,
set<string>& provided_dsos);
-string remove_trailing_white_spaces(const string&);
+string trim_white_space(const string&);
suppr::type_suppression_sptr
gen_suppr_spec_from_headers(const string& hdrs_root_dir);
diff --git a/src/abg-ini.cc b/src/abg-ini.cc
index c33e2ae..7558c2f 100644
--- a/src/abg-ini.cc
+++ b/src/abg-ini.cc
@@ -168,15 +168,13 @@ static bool
char_is_white_space(int b)
{return b == ' ' || b == '\t' || b == '\n';}
-/// Remove the trailing spaces at the begining and at the end of a
-/// given string.
+/// Remove the spaces at the begining and at the end of a given string.
///
-/// @param str the string to remove trailing white spaces from.
+/// @param str the string to remove leading and trailing white spaces from.
///
-/// @return the string resulting from the removal of trailing white
-/// space from @p str.
+/// @return the string resulting from the removal of white space from @p str.
static string
-remove_trailing_white_spaces(const string& str)
+trim_white_space(const string& str)
{
string result;
@@ -1401,8 +1399,7 @@ public:
assert(read_next_char(c));
v += c;
}
- string result = remove_trailing_white_spaces(v);
- return result;
+ return trim_white_space(v);
}
/// Read a string property value.
diff --git a/src/abg-tools-utils.cc b/src/abg-tools-utils.cc
index 38c4940..c560fb0 100644
--- a/src/abg-tools-utils.cc
+++ b/src/abg-tools-utils.cc
@@ -864,7 +864,7 @@ get_dsos_provided_by_rpm(const string& rpm_path, set<string>& provided_dsos)
++line)
{
string dso = line->substr(0, line->find('('));
- dso = remove_trailing_white_spaces(dso);
+ dso = trim_white_space(dso);
if (!dso.empty())
provided_dsos.insert(dso);
}
@@ -875,10 +875,9 @@ get_dsos_provided_by_rpm(const string& rpm_path, set<string>& provided_dsos)
///
/// @param str the input string to consider.
///
-/// @return the @p str string from which trailing white spaces have
-/// been removed.
+/// @return the @p str string with leading and trailing white spaces removed.
string
-remove_trailing_white_spaces(const string& str)
+trim_white_space(const string& str)
{
if (str.empty())
return "";
--
2.13.6