Skip to content
Browse files

Fix NetBlock destructor to delete substatements.

  • Loading branch information...
1 parent a265ba2 commit 76665b940449aa14503a483af607651b77960959 steve committed Jul 28, 2002
Showing with 56 additions and 39 deletions.
  1. +52 −1 net_proc.cc
  2. +4 −38 netlist.cc
View
53 net_proc.cc
@@ -17,14 +17,62 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: net_proc.cc,v 1.4 2002/04/21 04:59:08 steve Exp $"
+#ident "$Id: net_proc.cc,v 1.5 2002/07/28 23:58:45 steve Exp $"
#endif
# include "config.h"
# include "netlist.h"
# include <assert.h>
+NetBlock::NetBlock(Type t, NetScope*ss)
+: type_(t), subscope_(ss), last_(0)
+{
+}
+
+NetBlock::~NetBlock()
+{
+ while (last_ != 0) {
+ if (last_->next_ == last_) {
+ delete last_;
+ last_ = 0;
+ } else {
+ NetProc*cur = last_->next_;
+ last_->next_ = cur->next_;
+ cur->next_ = cur;
+ delete cur;
+ }
+ }
+}
+
+void NetBlock::append(NetProc*cur)
+{
+ if (last_ == 0) {
+ last_ = cur;
+ cur->next_ = cur;
+ } else {
+ cur->next_ = last_->next_;
+ last_->next_ = cur;
+ last_ = cur;
+ }
+}
+
+const NetProc* NetBlock::proc_first() const
+{
+ if (last_ == 0)
+ return 0;
+
+ return last_->next_;
+}
+
+const NetProc* NetBlock::proc_next(const NetProc*cur) const
+{
+ if (cur == last_)
+ return 0;
+
+ return cur->next_;
+}
+
NetCase::NetCase(NetCase::TYPE c, NetExpr*ex, unsigned cnt)
: type_(c), expr_(ex), nitems_(cnt)
{
@@ -129,6 +177,9 @@ const NetExpr* NetRepeat::expr() const
/*
* $Log: net_proc.cc,v $
+ * Revision 1.5 2002/07/28 23:58:45 steve
+ * Fix NetBlock destructor to delete substatements.
+ *
* Revision 1.4 2002/04/21 04:59:08 steve
* Add support for conbinational events by finding
* the inputs to expressions and some statements.
View
42 netlist.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: netlist.cc,v 1.194 2002/07/24 16:24:45 steve Exp $"
+#ident "$Id: netlist.cc,v 1.195 2002/07/28 23:58:44 steve Exp $"
#endif
# include "config.h"
@@ -1468,43 +1468,6 @@ const Link& NetRamDq::pin_Q(unsigned idx) const
return pin(3+awidth_+width()+idx);
}
-NetBlock::NetBlock(Type t, NetScope*ss)
-: type_(t), subscope_(ss), last_(0)
-{
-}
-
-NetBlock::~NetBlock()
-{
-}
-
-void NetBlock::append(NetProc*cur)
-{
- if (last_ == 0) {
- last_ = cur;
- cur->next_ = cur;
- } else {
- cur->next_ = last_->next_;
- last_->next_ = cur;
- last_ = cur;
- }
-}
-
-const NetProc* NetBlock::proc_first() const
-{
- if (last_ == 0)
- return 0;
-
- return last_->next_;
-}
-
-const NetProc* NetBlock::proc_next(const NetProc*cur) const
-{
- if (cur == last_)
- return 0;
-
- return cur->next_;
-}
-
NetBUFZ::NetBUFZ(NetScope*s, const string&n)
: NetNode(s, n, 2)
{
@@ -2341,6 +2304,9 @@ const NetProc*NetTaskDef::proc() const
/*
* $Log: netlist.cc,v $
+ * Revision 1.195 2002/07/28 23:58:44 steve
+ * Fix NetBlock destructor to delete substatements.
+ *
* Revision 1.194 2002/07/24 16:24:45 steve
* Rewrite find_similar_event to support doing
* all event matching and replacement in one

0 comments on commit 76665b9

Please sign in to comment.
Something went wrong with that request. Please try again.