diff options
author | 2019-02-06 10:24:34 +0100 | |
---|---|---|
committer | 2019-02-07 21:54:11 +0100 | |
commit | 3b899b86e67e3a5cc093d2dd9c0dcaeed197c806 (patch) | |
tree | 5efe135d75b1fd837549719bfa6572802870be1b /src/lib/netlist/plib/putil.cpp | |
parent | c8d0db0c83d4b72e86f6255b95ff45ccc475d85d (diff) |
netlist: Refactoring after adding clang-tidy support to netlist makefile
- convert macros to c++ code.
- order of device creation should not depend on std lib.
- some state saving cleanup.
- added support for clang-tidy to makefile.
- modifications triggered by clang-tidy-9.
Diffstat (limited to 'src/lib/netlist/plib/putil.cpp')
-rw-r--r-- | src/lib/netlist/plib/putil.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/netlist/plib/putil.cpp b/src/lib/netlist/plib/putil.cpp index 19f66ba6cbb..03f730f6ba2 100644 --- a/src/lib/netlist/plib/putil.cpp +++ b/src/lib/netlist/plib/putil.cpp @@ -2,13 +2,13 @@ // copyright-holders:Couriersud #include "putil.h" -#include "ptypes.h" #include "plists.h" +#include "ptypes.h" -#include <cstdlib> #include <algorithm> -#include <initializer_list> +#include <cstdlib> #include <cstring> +#include <initializer_list> namespace plib { @@ -17,7 +17,7 @@ namespace plib const pstring buildpath(std::initializer_list<pstring> list ) { pstring ret = ""; - for( auto elem : list ) + for( const auto &elem : list ) { if (ret == "") ret = elem; @@ -38,7 +38,7 @@ namespace plib else return pstring(std::getenv(var.c_str())); } - } + } // namespace util std::vector<pstring> psplit(const pstring &str, const pstring &onstr, bool ignore_empty) { @@ -102,7 +102,7 @@ namespace plib auto i = str.begin(); while (i != str.end()) { - std::size_t p = static_cast<std::size_t>(-1); + auto p = static_cast<std::size_t>(-1); for (std::size_t j=0; j < onstrl.size(); j++) { if (std::equal(onstrl[j].begin(), onstrl[j].end(), i)) @@ -161,7 +161,7 @@ namespace plib return cnt; return -1; } - pstring penum_base::nthstr(int n, const char *str) + std::string penum_base::nthstr(int n, const char *str) { char buf[64]; char *bufp = buf; @@ -186,6 +186,6 @@ namespace plib str++; } *bufp = 0; - return pstring(buf); + return std::string(buf); } } // namespace plib |