void *prev;
};
+
class dlist : public SMARTALLOC {
void *head;
void *tail;
int16_t loffset;
uint32_t num_items;
+ void (*free_method)(void *);
public:
dlist(void *item, dlink *link);
dlist(void);
void destroy();
void *first() const;
void *last() const;
+ void set_delete(void (*fun)(void *));
};
*/
inline void dlist::init(void *item, dlink *link)
{
+ free_method = NULL;
head = tail = NULL;
loffset = (int)((char *)link - (char *)item);
if (loffset < 0 || loffset > 5000) {
inline void dlist::init()
{
+ free_method = NULL;
head = tail = NULL;
loffset = 0;
num_items = 0;
}
/* Constructor with link at head of item */
-inline dlist::dlist(void) : head(0), tail(0), loffset(0), num_items(0)
+inline dlist::dlist(void) : head(0), tail(0), loffset(0), num_items(0), free_method(NULL)
{
}
return tail;
}
+inline void dlist::set_delete(void (*fun)(void *))
+{
+ free_method = fun;
+}
+
/*
* C string helper routines for dlist
* The string (char *) is kept in the node