aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flitem.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-04-18 15:07:41 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-04-18 15:07:41 +0000
commitd6d1febfad6698f55f077b7dd94330a46da83886 (patch)
treefc947ad11e4cd38cfd7d316b942600eb51b8b878 /externals/grill/flext/source/flitem.cpp
parent9727e8625658520e5fdbfb0b9e9903ad540da648 (diff)
changed template parameter of TableMap
fixed problems with symbol binding restructured TableMap type (doesn't own pointers any more) svn path=/trunk/; revision=2779
Diffstat (limited to 'externals/grill/flext/source/flitem.cpp')
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
index 4cab1481..057f1d44 100755
--- a/externals/grill/flext/source/flitem.cpp
+++ b/externals/grill/flext/source/flitem.cpp
@@ -15,6 +15,14 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flext.h"
#include <string.h>
+flext_base::ItemSet::~ItemSet() { clear(); }
+
+void flext_base::ItemSet::clear()
+{
+ for(iterator it(*this); it; ++it) delete it.data();
+ TablePtrMap<const t_symbol *,Item *,8>::clear();
+}
+
flext_base::Item::~Item()
{
@@ -57,8 +65,10 @@ void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet)
if(!Contained(inlet)) Resize(inlet+2);
ItemSet &set = GetInlet(inlet);
Item *lst = set.find(tag);
- if(!lst)
- set.insert(tag,lst = item);
+ if(!lst) {
+ Item *old = set.insert(tag,lst = item);
+ FLEXT_ASSERT(!old);
+ }
else
for(;;)
if(!lst->nxt) { lst->nxt = item; break; }
@@ -76,8 +86,10 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool
for(Item *prv = NULL; lit; prv = lit,lit = lit->nxt) {
if(lit == item) {
if(prv) prv->nxt = lit->nxt;
- else if(lit->nxt)
- set.insert(tag,lit->nxt);
+ else if(lit->nxt) {
+ Item *old = set.insert(tag,lit->nxt);
+ FLEXT_ASSERT(!old);
+ }
else {
Item *l = set.remove(tag);
FLEXT_ASSERT(l == lit);