aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flitem.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-04-15 02:41:04 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-04-15 02:41:04 +0000
commite4991ce586558b0ff3a06b7c0c4022d2083c4d01 (patch)
tree96e5d97482a50ae760cd9bdc8ea8401bd1bf6648 /externals/grill/flext/source/flitem.cpp
parentc58149336328a7c05d9c713368d30ea30ec0ac1b (diff)
""
svn path=/trunk/; revision=562
Diffstat (limited to 'externals/grill/flext/source/flitem.cpp')
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
index 1e5a26a6..7af91fea 100755
--- a/externals/grill/flext/source/flitem.cpp
+++ b/externals/grill/flext/source/flitem.cpp
@@ -68,6 +68,49 @@ void flext_base::itemarr::Add(item *it)
}
}
+bool flext_base::itemarr::Remove(item *it)
+{
+ if(Ready()) {
+ // retrieve array index
+ int ix = Hash(it->tag,it->inlet,bits);
+
+ // remove from array slot
+ if(arr[ix]) {
+ item *a1 = NULL,*a = arr[ix];
+ while(a && a != it) a1 = a,a = a->nxt;
+ if(a) { // found (a == it)
+ if(a1) a1->nxt = it->nxt;
+ else arr[ix] = it->nxt;
+ it->nxt = NULL;
+ return true;
+ }
+ else
+ return false;
+ }
+ else
+ return false;
+ }
+ else {
+ // remove from list
+ if(!arr[0])
+ return false;
+ else {
+ item *a1 = NULL,*a = arr[0];
+ while(a && a != it) a1 = a,a = a->nxt;
+ if(a) { // found (a == it)
+ if(a1) a1->nxt = it->nxt;
+ else arr[0] = it->nxt;
+ if(!it->nxt) arr[1] = a1;
+ it->nxt = NULL;
+ --cnt;
+ return true;
+ }
+ else
+ return false;
+ }
+ }
+}
+
void flext_base::itemarr::Finalize()
{
if(!Ready())