From 36cf09ca8289f241ee06b0d17bcb5b54208b36ff Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Mon, 20 Jan 2014 22:21:56 -0800 Subject: [PATCH] Minor style cleanup --- pyc_code.h | 2 +- pyc_module.cpp | 4 ---- pyc_module.h | 2 +- pyc_numeric.cpp | 6 ++---- pyc_string.cpp | 3 +-- pyc_string.h | 2 +- 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/pyc_code.h b/pyc_code.h index 4d295ff..a90a735 100644 --- a/pyc_code.h +++ b/pyc_code.h @@ -58,7 +58,7 @@ public: PycRef getCellVar(int idx) const { return (idx >= m_cellVars->size()) ? m_freeVars->get(idx - m_cellVars->size()) - : m_cellVars->get(idx); + : m_cellVars->get(idx); } const globals_t& getGlobals() const { return m_globalsUsed; } diff --git a/pyc_module.cpp b/pyc_module.cpp index 12903ec..8a94c88 100644 --- a/pyc_module.cpp +++ b/pyc_module.cpp @@ -1,10 +1,6 @@ #include "pyc_module.h" #include "data.h" -PycModule::PycModule() - : m_maj(-1), m_min(-1), m_unicode(false) -{ } - void PycModule::setVersion(unsigned int magic) { // Default for versions that don't support unicode selection diff --git a/pyc_module.h b/pyc_module.h index abc384b..08f56fd 100644 --- a/pyc_module.h +++ b/pyc_module.h @@ -32,7 +32,7 @@ enum PycMagic { class PycModule { public: - PycModule(); + PycModule() : m_maj(-1), m_min(-1), m_unicode(false) { } void loadFromFile(const char* filename); bool isValid() const { return (m_maj >= 0) && (m_min >= 0); } diff --git a/pyc_numeric.cpp b/pyc_numeric.cpp index 6db2ed8..44afaff 100644 --- a/pyc_numeric.cpp +++ b/pyc_numeric.cpp @@ -98,8 +98,7 @@ std::string PycLong::repr() const void PycFloat::load(PycData* stream, PycModule*) { int len = stream->getByte(); - if (m_value) - delete[] m_value; + delete[] m_value; if (len > 0) { m_value = new char[len+1]; stream->getBuffer(len, m_value); @@ -127,8 +126,7 @@ void PycComplex::load(PycData* stream, PycModule* mod) PycFloat::load(stream, mod); int len = stream->getByte(); - if (m_imag) - delete[] m_imag; + delete[] m_imag; if (len > 0) { m_imag = new char[len+1]; stream->getBuffer(len, m_imag); diff --git a/pyc_string.cpp b/pyc_string.cpp index 4679ac2..6c3c36c 100644 --- a/pyc_string.cpp +++ b/pyc_string.cpp @@ -46,8 +46,7 @@ static void ascii_to_utf8(char** data) /* PycString */ void PycString::load(PycData* stream, PycModule* mod) { - if (m_value) - delete[] m_value; + delete[] m_value; if (type() == TYPE_STRINGREF) { PycRef str = mod->getIntern(stream->get32()); diff --git a/pyc_string.h b/pyc_string.h index d42bd37..9b02a0b 100644 --- a/pyc_string.h +++ b/pyc_string.h @@ -10,7 +10,7 @@ public: PycString(int type = TYPE_STRING) : PycObject(type), m_value(0), m_length(0) { } - ~PycString() { if (m_value) delete[] m_value; } + ~PycString() { delete[] m_value; } bool isEqual(PycRef obj) const; bool isEqual(const char* str) const;