From 4a2da094910908734a65af97709ffaecdadc8264 Mon Sep 17 00:00:00 2001 From: Zachary Blair Date: Mon, 6 Jan 2014 08:02:04 +0100 Subject: [PATCH] minor cleanups. initialize members in initialization list --- lib/library.h | 8 ++++++-- lib/symboldatabase.h | 8 ++++++++ lib/tokenize.cpp | 31 ++++++++++++++++--------------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lib/library.h b/lib/library.h index ea146bf80..b2429480b 100644 --- a/lib/library.h +++ b/lib/library.h @@ -98,8 +98,12 @@ public: class ArgumentChecks { public: - ArgumentChecks() { - notbool = notnull = notuninit = formatstr = strz = false; + ArgumentChecks() : + notbool(false), + notnull(false), + notuninit(false), + formatstr(false), + strz(false) { } bool notbool; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 953d4a4bb..2a2cfd7ff 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -65,6 +65,10 @@ public: } needInitialization; struct BaseInfo { + BaseInfo() : + type(NULL), nameTok(NULL), access(Public), isVirtual(false) { + } + std::string name; const Type* type; const Token* nameTok; @@ -73,6 +77,10 @@ public: }; struct FriendInfo { + FriendInfo() : + nameStart(NULL), nameEnd(NULL), type(NULL) { + } + const Token* nameStart; const Token* nameEnd; std::string name; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8e3b895c6..46dc184ea 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -370,6 +370,7 @@ Token * Tokenizer::deleteInvalidTypedef(Token *typeDef) } struct Space { + Space() : classEnd(NULL), isNamespace(false) { } std::string className; const Token * classEnd; bool isNamespace; @@ -7531,23 +7532,23 @@ bool Tokenizer::duplicateDefinition(Token ** tokPtr, const Token * name) const class EnumValue { public: - EnumValue() { - name = 0; - value = 0; - start = 0; - end = 0; + EnumValue() : + name(NULL), + value(NULL), + start(NULL), + end(NULL) { } - EnumValue(const EnumValue &ev) { - name = ev.name; - value = ev.value; - start = ev.start; - end = ev.end; + EnumValue(const EnumValue &ev) : + name(ev.name), + value(ev.value), + start(ev.start), + end(ev.end) { } - EnumValue(Token *name_, Token *value_, Token *start_, Token *end_) { - name = name_; - value = value_; - start = start_; - end = end_; + EnumValue(Token *name_, Token *value_, Token *start_, Token *end_) : + name(name_), + value(value_), + start(start_), + end(end_) { } void simplify(const std::map &enumValues) {