Freeciv-3.1: /fast/freeciv/nightly/S3_1/utility/registry.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
registry.c
Go to the documentation of this file.
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.
7
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***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* libxml2 */
19#ifdef FREECIV_HAVE_XML_REGISTRY
20#include <libxml/parser.h>
21#endif /* FREECIV_HAVE_XML_REGISTRY */
22
23#include "registry_xml.h"
24
25#include "registry.h"
26
27/*********************************************************************/
30 void registry_module_init(void)
31{
32#ifdef FREECIV_HAVE_XML_REGISTRY
33 LIBXML_TEST_VERSION;
34#endif /* FREECIV_HAVE_XML_REGISTRY */
35}
36
37/*********************************************************************/
40 void registry_module_close(void)
41{
42#ifdef FREECIV_HAVE_XML_REGISTRY
43 xmlCleanupParser();
44#endif /* FREECIV_HAVE_XML_REGISTRY */
45}
46
47/*********************************************************************/
50 struct section_file *secfile_load(const char *filename,
51 bool allow_duplicates)
52{
53#ifdef FREECIV_HAVE_XML_REGISTRY
54 struct stat buf;
55
56 if (fc_stat(filename, &buf) == 0) {
57 xmlDoc *sec_doc;
58
59 sec_doc = xmlReadFile(filename, NULL, XML_PARSE_NOERROR);
60 if (sec_doc != NULL) {
61 return xmlfile_load(sec_doc, filename);
62 }
63 }
64#endif /* FREECIV_HAVE_XML_REGISTRY */
65
66 return secfile_load_section(filename, NULL, allow_duplicates);
67}
secfile_load
struct section_file * secfile_load(const char *filename, bool allow_duplicates)
Definition registry.c:50
registry_module_init
void registry_module_init(void)
Definition registry.c:30
registry_module_close
void registry_module_close(void)
Definition registry.c:40
registry.h
secfile_load_section
struct section_file * secfile_load_section(const char *filename, const char *section, bool allow_duplicates)
Definition registry_ini.c:593
registry_xml.h
section_file
Definition section_file.h:36
section_file::allow_duplicates
bool allow_duplicates
Definition section_file.h:45
fc_stat
int fc_stat(const char *filename, struct stat *buf)
Definition support.c:575