Module.cc
Go to the documentation of this file.
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/Libxml2Parser.h"
11 #include "esi/Module.h"
12 /* include for esi/ExpatParser.h must follow esi/Libxml2Parser.h */
13 /* do not remove this comment, as it acts as barrier for the autmatic sorting */
14 #include "esi/ExpatParser.h"
15 
16 #if HAVE_LIBXML2
17 static ESIParser::Register *prLibxml = 0;
18 #endif
19 #if HAVE_LIBEXPAT
20 static ESIParser::Register *prExpat = 0;
21 #endif
22 
23 void Esi::Init()
24 {
25  // register in reverse order of preference.
26  // The latest registered parser will be used as default.
27 #if HAVE_LIBEXPAT
28  assert(!prExpat); // we should be called once
29  prExpat = new ESIParser::Register("expat", &ESIExpatParser::NewParser);
30 #endif
31 
32 #if HAVE_LIBXML2
33  assert(!prLibxml); // we should be called once
34  prLibxml = new ESIParser::Register("libxml2", &ESILibxml2Parser::NewParser);
35 #endif
36 }
37 
38 void Esi::Clean()
39 {
40 #if HAVE_LIBEXPAT
41  delete prExpat;
42  prExpat = NULL;
43 #endif
44 
45 #if HAVE_LIBXML2
46  delete prLibxml;
47  prLibxml = NULL;
48 #endif
49 }
50 
#define assert(EX)
Definition: assert.h:17
void Clean()
Definition: Module.cc:38
#define NULL
Definition: types.h:166
void Init()
Definition: Module.cc:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors