Code cleanups

This commit is contained in:
Daniel Marjamäki 2013-10-23 15:03:31 +02:00
parent c11ee0a1ed
commit c6702db9ab
1 changed files with 5 additions and 4 deletions

View File

@ -301,6 +301,8 @@ private:
}; };
class CodeBlock { class CodeBlock {
public: public:
CodeBlock() : _offset(0) {}
void setStart(const std::string& s) { void setStart(const std::string& s) {
_start = s; _start = s;
} }
@ -311,7 +313,7 @@ private:
_offset = o; _offset = o;
} }
void addBlock(const std::string& blockName) { void addBlock(const std::string& blockName) {
_blocks.push_back(blockName); _blocks.insert(blockName);
} }
std::string start() const { std::string start() const {
return _start; return _start;
@ -323,15 +325,14 @@ private:
return _offset; return _offset;
} }
bool isBlock(const std::string& blockName) const { bool isBlock(const std::string& blockName) const {
return std::find(_blocks.begin(), _blocks.end(), blockName) return _blocks.find(blockName) != _blocks.end();
!= _blocks.end();
} }
private: private:
std::string _start; std::string _start;
std::string _end; std::string _end;
int _offset; int _offset;
std::list<std::string> _blocks; std::set<std::string> _blocks;
}; };
int allocid; int allocid;
std::map<std::string, int> _alloc; // allocation functions std::map<std::string, int> _alloc; // allocation functions