Removed silencing of gtk warning logs from gtk3.22-client.
[freeciv.git] / utility / registry.c
blob093699b08729f711415b7eaf4461b379fdf0aab7
1 /***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 /* libxml2 */
19 #ifdef FREECIV_HAVE_XML_REGISTRY
20 #include <libxml/parser.h>
21 #endif /* FREECIV_HAVE_XML_REGISTRY */
23 #include "registry_xml.h"
25 #include "registry.h"
27 /*************************************************************************
28 Initialize registry module
29 *************************************************************************/
30 void registry_module_init(void)
32 #ifdef FREECIV_HAVE_XML_REGISTRY
33 LIBXML_TEST_VERSION;
34 #endif /* FREECIV_HAVE_XML_REGISTRY */
37 /*************************************************************************
38 Closes registry module
39 *************************************************************************/
40 void registry_module_close(void)
42 #ifdef FREECIV_HAVE_XML_REGISTRY
43 xmlCleanupParser();
44 #endif /* FREECIV_HAVE_XML_REGISTRY */
47 /**************************************************************************
48 Create a section file from a file. Returns NULL on error.
49 **************************************************************************/
50 struct section_file *secfile_load(const char *filename,
51 bool allow_duplicates)
53 #ifdef FREECIV_HAVE_XML_REGISTRY
54 struct stat buf;
56 if (fc_stat(filename, &buf) == 0) {
57 xmlDoc *sec_doc;
59 sec_doc = xmlReadFile(filename, NULL, XML_PARSE_NOERROR);
60 if (sec_doc != NULL) {
61 return xmlfile_load(sec_doc, filename);
64 #endif /* FREECIV_HAVE_XML_REGISTRY */
66 return secfile_load_section(filename, NULL, allow_duplicates);