From 51aadcf9017c9c4b1c86302fa3bb65cc67dcc05b Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 9 Feb 2018 06:35:01 +0000 Subject: A few fixes dicatated by valgrind. --- node/Dictionary.hpp | 53 ++++++++++++++++++++--------------------------------- node/Switch.cpp | 1 + 2 files changed, 21 insertions(+), 33 deletions(-) (limited to 'node') diff --git a/node/Dictionary.hpp b/node/Dictionary.hpp index 59afb7c6..f89b6ffc 100644 --- a/node/Dictionary.hpp +++ b/node/Dictionary.hpp @@ -62,40 +62,24 @@ template class Dictionary { public: - Dictionary() - { - _d[0] = (char)0; - } - - Dictionary(const char *s) - { - if (s) { - Utils::scopy(_d,sizeof(_d),s); - } else { - _d[0] = (char)0; - } - } - + Dictionary() { memset(_d,0,sizeof(_d)); } + Dictionary(const char *s) { this->load(s); } Dictionary(const char *s,unsigned int len) { - if (s) { - if (len > (C-1)) - len = C-1; - ZT_FAST_MEMCPY(_d,s,len); - _d[len] = (char)0; - } else { - _d[0] = (char)0; + for(unsigned int i=0;i