diff options
author | 2016-05-31 23:49:55 +0200 | |
---|---|---|
committer | 2016-06-07 21:44:15 +0200 | |
commit | 81880659d23b36598f498e32f24fd6a4cecbd80b (patch) | |
tree | d7cd226d8335ba06fab273b1616231881ecfe766 /src/lib/netlist/plib/pstring.cpp | |
parent | 3d3f5761f0b0419581762f72ea0984e047d3e55c (diff) |
- More code cleanup.
- Dead code removal and minor refactoring.
- Simplify. Align naming with stl. Fix somed pedantic warnings.
- More STL compatability.
- Remove ATTR_HOT and ATTR_COLD. Refactored netlist_time.
- Fix long standing workaround which would ignore policy of change-only"
propagation.
- Rewrote for loops to use auto : semantics.
- Truthtable cleanup. (nw)
- Get rid of nl_math. Remove nl_util.h and moved contents to
plib/putil.h.
- Fix standalone build. Refactor ptypes.h.
[Couriersud]
Diffstat (limited to 'src/lib/netlist/plib/pstring.cpp')
-rw-r--r-- | src/lib/netlist/plib/pstring.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 7dadb9e6240..cb8011734b4 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -11,6 +11,7 @@ #include <cstdlib> #include <cstdio> #include <algorithm> +#include <stack> #include "pstring.h" #include "palloc.h" @@ -131,8 +132,6 @@ const pstring_t<F> pstring_t<F>::substr(int start, int count) const ret.pcopy(p, 0); else { - //FIXME: Trait to tell which one - //ret.pcopy(cstr() + start, count); // find start for (int i=0; i<start; i++) p += F::codelen(p); @@ -149,7 +148,7 @@ const pstring_t<F> pstring_t<F>::ucase() const { pstring_t ret = *this; ret.pcopy(cstr(), blen()); - for (unsigned i=0; i<ret.len(); i++) + for (std::size_t i=0; i<ret.len(); i++) ret.m_ptr->str()[i] = toupper((unsigned) ret.m_ptr->str()[i]); return ret; } @@ -160,11 +159,11 @@ int pstring_t<F>::find_first_not_of(const pstring_t &no) const char *t = m_ptr->str(); unsigned nolen = no.len(); unsigned tlen = len(); - for (unsigned i=0; i < tlen; i++) + for (std::size_t i=0; i < tlen; i++) { char *n = no.m_ptr->str(); bool f = true; - for (unsigned j=0; j < nolen; j++) + for (std::size_t j=0; j < nolen; j++) { if (F::code(t) == F::code(n)) f = false; @@ -184,11 +183,11 @@ int pstring_t<F>::find_last_not_of(const pstring_t &no) const unsigned nolen = no.len(); unsigned tlen = len(); int last_found = -1; - for (unsigned i=0; i < tlen; i++) + for (std::size_t i=0; i < tlen; i++) { char *n = no.m_ptr->str(); bool f = true; - for (unsigned j=0; j < nolen; j++) + for (std::size_t j=0; j < nolen; j++) { if (F::code(t) == F::code(n)) f = false; @@ -394,7 +393,7 @@ void pstring_t<F>::resetmem() { if (stk != nullptr) { - for (unsigned i=0; i<=16; i++) + for (std::size_t i=0; i<=16; i++) { for (; stk[i].size() > 0; ) { @@ -450,7 +449,7 @@ int pstring_t<F>::find(const pstring_t &search, unsigned start) const const char *s = search.cstr(); const unsigned startt = std::min(start, tlen); const char *t = cstr(); - for (unsigned i=0; i<startt; i++) + for (std::size_t i=0; i<startt; i++) t += F::codelen(t); for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++) { @@ -479,7 +478,7 @@ int pstring_t<F>::find(const mem_t *search, unsigned start) const const char *s = search; const unsigned startt = std::min(start, tlen); const char *t = cstr(); - for (unsigned i=0; i<startt; i++) + for (std::size_t i=0; i<startt; i++) t += F::codelen(t); for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++) { |