]> git.ipfire.org Git - thirdparty/squid.git/blob - src/SquidList.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / SquidList.cc
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 /* DEBUG: none Linked list functions (deprecated) */
10
11 #include "squid.h"
12 #include "mem/forward.h"
13 #include "SquidList.h"
14 #include "typedefs.h"
15
16 /* This should go away, in favour of the List template class */
17
18 void
19 linklistPush(link_list ** L, void *p)
20 {
21 link_list *l = (link_list *)memAllocate(MEM_LINK_LIST);
22 l->next = NULL;
23 l->ptr = p;
24
25 while (*L)
26 L = &(*L)->next;
27
28 *L = l;
29 }
30
31 void *
32 linklistShift(link_list ** L)
33 {
34 void *p;
35 link_list *l;
36
37 if (NULL == *L)
38 return NULL;
39
40 l = *L;
41
42 p = l->ptr;
43
44 *L = (*L)->next;
45
46 memFree(l, MEM_LINK_LIST);
47
48 return p;
49 }
50