aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flbind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source/flbind.cpp')
-rw-r--r--externals/grill/flext/source/flbind.cpp54
1 files changed, 24 insertions, 30 deletions
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
index 01b23b6f..5a8f0743 100644
--- a/externals/grill/flext/source/flbind.cpp
+++ b/externals/grill/flext/source/flbind.cpp
@@ -99,19 +99,16 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo
bindhead = new ItemCont;
else {
// Search for symbol
- ItemList *lst = bindhead->FindList(sym);
-
- if(lst)
- for(ItemList::iterator it = lst->begin(); it != lst->end(); ++it) {
- BindItem *item = (BindItem *)*it;
-
- // go through all items with matching tag
- if(item->fun == fun) {
- // function already registered -> bail out!
- post("%s - Symbol already bound with this method",thisName());
- return false;
- }
+ for(Item *it = bindhead->FindList(sym); it; it = it->nxt) {
+ BindItem *item = (BindItem *)it;
+
+ // go through all items with matching tag
+ if(item->fun == fun) {
+ // function already registered -> bail out!
+ post("%s - Symbol already bound with this method",thisName());
+ return false;
}
+ }
}
SetupBindProxy();
@@ -166,8 +163,8 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym
BindItem *it = NULL;
for(ItemSet::iterator si = it1; si != it2 && !it; ++si) {
- for(ItemList::iterator i = si->second.begin(); i != si->second.end(); ++i) {
- BindItem *item = (BindItem *)*i;
+ for(Item *i = si.data(); i; i = i->nxt) {
+ BindItem *item = (BindItem *)i;
if(!fun || item->fun == fun) { it = item; break; }
}
}
@@ -188,18 +185,15 @@ bool flext_base::GetBoundMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_s
{
if(bindhead) {
// Search for symbol
- ItemList *lst = bindhead->FindList(sym);
-
- if(lst)
- for(ItemList::iterator it = lst->begin(); it != lst->end(); ++it) {
- BindItem *item = (BindItem *)*it;
+ for(Item *it = bindhead->FindList(sym); it; it = it->nxt) {
+ BindItem *item = (BindItem *)it;
- // go through all items with matching tag
- if(item->fun == fun) {
- data = item->px->data;
- return true;
- }
+ // go through all items with matching tag
+ if(item->fun == fun) {
+ data = item->px->data;
+ return true;
}
+ }
}
return false;
}
@@ -209,13 +203,13 @@ bool flext_base::UnbindAll()
if(bindhead && bindhead->Contained(0)) {
ItemSet &set = bindhead->GetInlet();
for(ItemSet::iterator si = set.begin(); si != set.end(); ++si) {
- ItemList &lst = si->second;
- while(!lst.empty()) {
- // eventual allocated data in item is not freed!
- BindItem *it = (BindItem *)lst.front();
- it->Unbind(si->first);
+ Item *lst = si.data();
+ while(lst) {
+ Item *nxt = lst->nxt;
+ BindItem *it = (BindItem *)lst;
+ it->Unbind(si.key());
delete it;
- lst.pop_front();
+ lst = nxt;
}
}
set.clear();