diff options
author | 2017-01-22 23:36:54 +0100 | |
---|---|---|
committer | 2017-01-25 22:17:46 +0100 | |
commit | 093bda019317a5a66699b35f8b25ab73802f1f1c (patch) | |
tree | b0e35b6f83d8cba9f7d69eda8c857cf799f1bfc1 /src/lib/netlist/plib/pstring.cpp | |
parent | 624463dc3457e2719af007a6afee3da107af4a94 (diff) |
Added infix notation parsing to the function parser. (nw)
Diffstat (limited to 'src/lib/netlist/plib/pstring.cpp')
-rw-r--r-- | src/lib/netlist/plib/pstring.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 7d676f34c0d..1a65bb152ff 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -6,10 +6,6 @@ */ #include <cstring> -//FIXME:: pstring should be locale free -#include <cctype> -#include <cstdlib> -#include <cstdio> #include <algorithm> #include <stack> @@ -17,6 +13,8 @@ #include "palloc.h" #include "plists.h" +template <typename F> pstr_t pstring_t<F>::m_zero(0); + template<typename F> pstring_t<F>::~pstring_t() { @@ -373,7 +371,7 @@ void pstringbuffer::pcat(const pstring &s) * This improves startup performance by 30%. */ -#if 1 +#if 0 static std::stack<pstr_t *> *stk = nullptr; @@ -416,8 +414,8 @@ static inline std::size_t countleadbits(std::size_t x) template<typename F> void pstring_t<F>::sfree(pstr_t *s) { - s->m_ref_count--; - if (s->m_ref_count == 0 && s != &m_zero) + bool b = s->dec_and_check(); + if ( b && s != &m_zero) { if (stk != nullptr) { @@ -472,8 +470,8 @@ void pstring_t<F>::resetmem() template<typename F> void pstring_t<F>::sfree(pstr_t *s) { - s->m_ref_count--; - if (s->m_ref_count == 0 && s != &m_zero) + bool b = s->dec_and_check(); + if ( b && s != &m_zero) { plib::pfree_array(((char *)s)); } |