]> git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/Module.cc
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / esi / Module.cc
1 /*
2 * Copyright (C) 1996-2018 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 #include "squid.h"
10 #include "esi/CustomParser.h"
11 #include "esi/Libxml2Parser.h"
12 #include "esi/Module.h"
13 /* include for esi/ExpatParser.h must follow esi/Libxml2Parser.h */
14 /* do not remove this comment, as it acts as barrier for the autmatic sorting */
15 #include "esi/ExpatParser.h"
16
17 static ESIParser::Register *prCustom = 0;
18 #if HAVE_LIBXML2
19 static ESIParser::Register *prLibxml = 0;
20 #endif
21 #if HAVE_LIBEXPAT
22 static ESIParser::Register *prExpat = 0;
23 #endif
24
25 void Esi::Init()
26 {
27 assert(!prCustom); // we should be called once
28
29 prCustom = new ESIParser::Register("custom", &ESICustomParser::NewParser);
30
31 #if HAVE_LIBXML2
32 prLibxml = new ESIParser::Register("libxml2", &ESILibxml2Parser::NewParser);
33 #endif
34
35 #if HAVE_LIBEXPAT
36 prExpat = new ESIParser::Register("expat", &ESIExpatParser::NewParser);
37 #endif
38 }
39
40 void Esi::Clean()
41 {
42 assert(prCustom); // we should be called once, and only after Init()
43
44 #if HAVE_LIBEXPAT
45 delete prExpat;
46 prExpat = NULL;
47 #endif
48
49 #if HAVE_LIBXML2
50 delete prLibxml;
51 prLibxml = NULL;
52 #endif
53
54 delete prCustom;
55 prCustom = NULL;
56 }
57