mirror of
https://github.com/cmosher01/v6502cpp.git
synced 2024-10-31 16:05:31 +00:00
fix mem leak and -Wall warnings
This commit is contained in:
parent
a10889ecd8
commit
e05f941086
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
CXXFLAGS=-g -std=c++11
|
CXXFLAGS=-g -std=c++11 -Wall -O4
|
||||||
|
|
||||||
SRCS = v6502.cpp trans.cpp SegmentCache.cpp TransNetwork.cpp Trace.cpp Circuit.cpp StateCalculator.cpp Cpu6502.cpp
|
SRCS = v6502.cpp trans.cpp SegmentCache.cpp TransNetwork.cpp Trace.cpp Circuit.cpp StateCalculator.cpp Cpu6502.cpp
|
||||||
OBJS = $(SRCS:.cpp=.o)
|
OBJS = $(SRCS:.cpp=.o)
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
class SegmentCache {
|
class SegmentCache {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SegmentCache() {
|
SegmentCache() : c(nullptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~SegmentCache() {
|
virtual ~SegmentCache() {
|
||||||
|
delete this->c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Segment* getOrAdd(const std::string& id);
|
Segment* getOrAdd(const std::string& id);
|
||||||
@ -162,11 +163,11 @@ public:
|
|||||||
P0(P0), P1(P1), P2(P2), P3(P3), P4(P4), /* no P5 */ P6(P6), P7(P7),
|
P0(P0), P1(P1), P2(P2), P3(P3), P4(P4), /* no P5 */ P6(P6), P7(P7),
|
||||||
S0(S0), S1(S1), S2(S2), S3(S3), S4(S4), S5(S5), S6(S6), S7(S7) {
|
S0(S0), S1(S1), S2(S2), S3(S3), S4(S4), S5(S5), S6(S6), S7(S7) {
|
||||||
}
|
}
|
||||||
~Common();
|
~Common() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Common(const Common&);
|
Common(const Common&) = delete;
|
||||||
Common& operator=(const Common&);
|
Common& operator=(const Common&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
void initCommon();
|
void initCommon();
|
||||||
@ -186,8 +187,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::map<const std::string, std::shared_ptr<Segment > > cache;
|
std::map<const std::string, std::shared_ptr<Segment > > cache;
|
||||||
|
|
||||||
SegmentCache(const SegmentCache&);
|
SegmentCache(const SegmentCache&) = delete;
|
||||||
SegmentCache& operator=(const SegmentCache&);
|
SegmentCache& operator=(const SegmentCache&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SEGMENTCACHE_H */
|
#endif /* SEGMENTCACHE_H */
|
||||||
|
6
trans.h
6
trans.h
@ -19,9 +19,9 @@ public:
|
|||||||
std::set<Trans*> gates;
|
std::set<Trans*> gates;
|
||||||
std::set<Trans*> c1c2s;
|
std::set<Trans*> c1c2s;
|
||||||
|
|
||||||
bool pullup;
|
|
||||||
bool pulldown;
|
|
||||||
bool on;
|
bool on;
|
||||||
|
bool pulldown;
|
||||||
|
bool pullup;
|
||||||
|
|
||||||
bool vss;
|
bool vss;
|
||||||
bool vcc;
|
bool vcc;
|
||||||
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Trans(Segment* c1, Segment* gate, Segment* c2) : on(false), c1(c1), gate(gate), c2(c2) {
|
Trans(Segment* c1, Segment* gate, Segment* c2) : c1(c1), gate(gate), c2(c2), on(false) {
|
||||||
c1->c1c2s.insert(this);
|
c1->c1c2s.insert(this);
|
||||||
gate->gates.insert(this);
|
gate->gates.insert(this);
|
||||||
c2->c1c2s.insert(this);
|
c2->c1c2s.insert(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user