]> git.ipfire.org Git - thirdparty/squid.git/blob - tools/purge/squid-tlv.cc
Improved compatibility with clang and icc
[thirdparty/squid.git] / tools / purge / squid-tlv.cc
1 // Author: Jens-S. V?ckler <voeckler@rvs.uni-hannover.de>
2 //
3 // File: squid-tlv.cc
4 // Tue Jun 15 1999
5 //
6 // (c) 1999 Lehrgebiet Rechnernetze und Verteilte Systeme
7 // Universit?t Hannover, Germany
8 //
9 // Permission to use, copy, modify, distribute, and sell this software
10 // and its documentation for any purpose is hereby granted without fee,
11 // provided that (i) the above copyright notices and this permission
12 // notice appear in all copies of the software and related documentation,
13 // and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte
14 // Systeme and the University of Hannover may not be used in any
15 // advertising or publicity relating to the software without the
16 // specific, prior written permission of Lehrgebiet Rechnernetze und
17 // Verteilte Systeme and the University of Hannover.
18 //
19 // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
20 // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
21 // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
22 //
23 // IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR
24 // THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
25 // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
26 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
27 // ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
28 // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
29 // SOFTWARE.
30 //
31 // Revision 1.1 1999/06/15 21:10:16 voeckler
32 // Initial revision
33 //
34 //
35 #include "squid.h"
36 //#include <assert.h>
37 #include "squid-tlv.hh"
38
39 SquidTLV::SquidTLV( SquidMetaType _type, size_t _size, void* _data )
40 :next(0),size(_size)
41 {
42 type = _type;
43 data = (char*) _data;
44 }
45
46 SquidMetaList::SquidMetaList()
47 {
48 head = tail = 0;
49 }
50
51 SquidMetaList::~SquidMetaList()
52 {
53 for ( SquidTLV* temp = head; temp; temp = head ) {
54 head = temp->next;
55 delete temp;
56 }
57 }
58
59 void
60 SquidMetaList::append( SquidMetaType type, size_t size, void* data )
61 {
62 SquidTLV* temp = new SquidTLV( type, size, data );
63 if ( head == 0 ) head = tail = temp;
64 else {
65 tail->next = temp;
66 tail = temp;
67 }
68 }
69
70 const SquidTLV*
71 SquidMetaList::search( SquidMetaType type ) const
72 {
73 const SquidTLV* temp = head;
74 while ( temp && temp->type != type ) temp = temp->next;
75 return temp;
76 }