2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
12 /* dlink are Mem-pooled */
15 dlink_list ClientActiveRequests
;
17 MemAllocator
*dlink_node_pool
= NULL
;
22 if (dlink_node_pool
== NULL
)
23 dlink_node_pool
= memPoolCreate("Dlink list nodes", sizeof(dlink_node
));
25 /* where should we call delete dlink_node_pool;dlink_node_pool = NULL; */
26 return (dlink_node
*)dlink_node_pool
->alloc();
29 /** The node needs to be unlinked FIRST */
31 dlinkNodeDelete(dlink_node
* m
)
36 dlink_node_pool
->freeOne(m
);
40 dlinkAdd(void *data
, dlink_node
* m
, dlink_list
* list
)
51 if (list
->tail
== NULL
)
56 dlinkAddAfter(void *data
, dlink_node
* m
, dlink_node
* n
, dlink_list
* list
)
65 assert(list
->tail
== n
);
73 dlinkAddTail(void *data
, dlink_node
* m
, dlink_list
* list
)
84 if (list
->head
== NULL
)
89 dlinkDelete(dlink_node
* m
, dlink_list
* list
)
92 m
->next
->prev
= m
->prev
;
95 m
->prev
->next
= m
->next
;
101 list
->tail
= m
->prev
;
103 m
->next
= m
->prev
= NULL
;