summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2015-10-29 22:22:47 +1000
committerTim Mayberry <mojofunk@gmail.com>2015-12-01 14:22:38 +1000
commit36fa6703095ec8d562a5ab87269486d82294b4ef (patch)
tree45e3210ece92890b3b162f889aabe83a23f6a46c
parent5f4f89fb39236aea59a4c92a0f28622a7224fcb4 (diff)
Rename PBD::symbol_demangle and some variable names to improve readability
Rename PBD::symbol_demangle to demangle_symbol so the transitive verb is infront of the object. Rename some local variables and fix documentation.
-rw-r--r--libs/pbd/demangle.cc26
-rw-r--r--libs/pbd/pbd/demangle.h8
2 files changed, 17 insertions, 17 deletions
diff --git a/libs/pbd/demangle.cc b/libs/pbd/demangle.cc
index 3f355806ee..cd084ec3c9 100644
--- a/libs/pbd/demangle.cc
+++ b/libs/pbd/demangle.cc
@@ -24,44 +24,44 @@
#endif
std::string
-PBD::symbol_demangle (const std::string& l)
+PBD::demangle_symbol (const std::string& mangled_symbol)
{
#if defined(__GLIBCXX__)
int status;
try {
- char* realname = abi::__cxa_demangle (l.c_str(), 0, 0, &status);
- std::string d (realname);
+ char* realname = abi::__cxa_demangle (mangled_symbol.c_str(), 0, 0, &status);
+ std::string demangled_symbol (realname);
free (realname);
- return d;
+ return demangled_symbol;
} catch (std::exception) {
}
#endif
- return l;
+ return mangled_symbol;
}
std::string
-PBD::demangle (std::string const & l)
+PBD::demangle (std::string const& str)
{
- std::string::size_type const b = l.find_first_of ("(");
+ std::string::size_type const b = str.find_first_of ("(");
if (b == std::string::npos) {
- return symbol_demangle (l);
+ return demangle_symbol (str);
}
- std::string::size_type const p = l.find_last_of ("+");
+ std::string::size_type const p = str.find_last_of ("+");
if (p == std::string::npos) {
- return symbol_demangle (l);
+ return demangle_symbol (str);
}
if ((p - b) <= 1) {
- return symbol_demangle (l);
+ return demangle_symbol (str);
}
- std::string const fn = l.substr (b + 1, p - b - 1);
+ std::string const symbol = str.substr (b + 1, p - b - 1);
- return symbol_demangle (fn);
+ return demangle_symbol (symbol);
}
diff --git a/libs/pbd/pbd/demangle.h b/libs/pbd/pbd/demangle.h
index 1ca2925fd0..98b8bf787c 100644
--- a/libs/pbd/pbd/demangle.h
+++ b/libs/pbd/pbd/demangle.h
@@ -54,17 +54,17 @@ namespace PBD
}
/**
- * @param a mangled symbol/name
+ * @param symbol a mangled symbol/name
* @return a demangled symbol/name
*/
- LIBPBD_API std::string symbol_demangle(const std::string&);
+ LIBPBD_API std::string demangle_symbol(const std::string& symbol);
/**
- * @param a string containing a mangled symbol/name
+ * @param str a string containing a mangled symbol/name
* @return a string with the mangled symbol/name replaced with a demangled
* name
*/
- LIBPBD_API std::string demangle(const std::string&);
+ LIBPBD_API std::string demangle(const std::string& str);
} // namespace