Minor style cleanup

This commit is contained in:
Michael Hansen
2014-01-20 22:21:56 -08:00
parent 6787d57a28
commit 36cf09ca82
6 changed files with 6 additions and 13 deletions

View File

@@ -58,7 +58,7 @@ public:
PycRef<PycObject> 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; }

View File

@@ -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

View File

@@ -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); }

View File

@@ -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);

View File

@@ -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<PycString> str = mod->getIntern(stream->get32());

View File

@@ -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<PycObject> obj) const;
bool isEqual(const char* str) const;