2 * Copyright (C) 1996-2015 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_node use explicit alloc()/freeOne()
13 * XXX: convert to MEMPROXY_CLASS() API
17 dlink_list ClientActiveRequests
;
19 MemAllocator
*dlink_node_pool
= NULL
;
24 if (dlink_node_pool
== NULL
)
25 dlink_node_pool
= memPoolCreate("Dlink list nodes", sizeof(dlink_node
));
27 /* where should we call delete dlink_node_pool;dlink_node_pool = NULL; */
28 return (dlink_node
*)dlink_node_pool
->alloc();
31 /** The node needs to be unlinked FIRST */
33 dlinkNodeDelete(dlink_node
* m
)
38 dlink_node_pool
->freeOne(m
);
42 dlinkAdd(void *data
, dlink_node
* m
, dlink_list
* list
)
53 if (list
->tail
== NULL
)
58 dlinkAddAfter(void *data
, dlink_node
* m
, dlink_node
* n
, dlink_list
* list
)
67 assert(list
->tail
== n
);
75 dlinkAddTail(void *data
, dlink_node
* m
, dlink_list
* list
)
86 if (list
->head
== NULL
)
91 dlinkDelete(dlink_node
* m
, dlink_list
* list
)
94 m
->next
->prev
= m
->prev
;
97 m
->prev
->next
= m
->next
;
100 list
->head
= m
->next
;
103 list
->tail
= m
->prev
;
105 m
->next
= m
->prev
= NULL
;