cl_list::~cl_list(void)
{
- delete Items;
+ //delete Items;
+ free(Items);
}
void
cl_list::disconn(void *item)
{
- disconn_at(index_of(item));
+ t_index i;
+
+ if (index_of(item, &i))
+ disconn_at(i);
}
free_item(Item);
}
+void
+cl_list::free_all(void)
+{
+ t_index i;
+
+ if (count)
+ {
+ for (i= count-1; i; i--)
+ free_at(i);
+ free_at(0);
+ }
+}
+
/*
* Inserting a new item to the exact position
return(0); /* Needed by Sun! */
}
+bool
+cl_list::index_of(void *item, t_index *idx)
+{
+ for (t_index i= 0; i < count; i++)
+ if (item == Items[i])
+ {
+ if (idx)
+ *idx= i;
+ return(DD_TRUE);
+ }
+ return(DD_FALSE);
+}
+
/*
* Inserting a new item to the collection.
AItems= 0;
else
{
- AItems = new void *[alimit];
- //i= ALimit*(sizeof(void *));
- //AItems= (void **)malloc(i);
+ //AItems = new void *[alimit];
+ int i= alimit*(sizeof(void *));
+ AItems= (void **)malloc(i);
if (count)
memcpy(AItems, Items, count*sizeof(void *));
}
- delete Items;
+ //delete Items;
+ free(Items);
Items= AItems;
Limit= alimit;
}