summaryrefslogtreecommitdiffstats
path: root/bus/config-loader-libxml.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2004-04-09 19:50:29 +0000
committerJon Trowbridge <trow@ximian.com>2004-04-09 19:50:29 +0000
commite039be5838a6befdb4a378fcdc1fc2e7606d4222 (patch)
treef3f4a33480ee755422819c1572298a354551a737 /bus/config-loader-libxml.c
parent8056390e00ca6576323d6c41a4dc725bcba9b527 (diff)
2004-04-09 Jon Trowbridge <trow@ximian.com>
* bus/config-parser.c (bus_config_parser_new): Added a 'parent' argument. If non-null, the newly-constructed BusConfigParser will be initialized with the parent's BusLimits instead of the default values. (include_file): When including a config file, pass in the current parser as the parent and then copy the BusLimits from the included BusConfigParser pack to the current parser. (process_test_valid_subdir): Renamed from process_test_subdir. (process_test_equiv_subdir): Added. Walks through a directory, descending into each subdirectory and loading the config files it finds there. If any subdirectory contains two config files that don't produce identical BusConfigParser structs, fail. For now, the BusConfigParser's BusPolicies are not compared. (bus_config_parser_test): Call both process_test_valid_subdir and process_test_equiv_subdir. * bus/config-loader-libxml.c (bus_config_load): Take a parent argument and pass it along to the call to bus_config_parser_new. Also made a few small changes to allow this code to compile. * bus/config-loader-expat.c (bus_config_load): Take a parent argument and pass it along to the call to bus_config_parser_new. * bus/bus.c (bus_context_new): Load the config file with a NULL parent argument.
Diffstat (limited to 'bus/config-loader-libxml.c')
-rw-r--r--bus/config-loader-libxml.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/bus/config-loader-libxml.c b/bus/config-loader-libxml.c
index 4e0ebe8b..054acc6e 100644
--- a/bus/config-loader-libxml.c
+++ b/bus/config-loader-libxml.c
@@ -71,18 +71,22 @@ xml_text_reader_error (void *arg,
}
BusConfigParser*
-bus_config_load (const DBusString *file,
- DBusError *error)
+bus_config_load (const DBusString *file,
+ dbus_bool_t is_toplevel,
+ const BusConfigParser *parent,
+ DBusError *error)
+
{
xmlTextReader *reader;
const char *filename;
BusConfigParser *parser;
+ DBusString dirname;
DBusError tmp_error;
int ret;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- _dbus_string_get_const_data (file, &filename);
+ filename = _dbus_string_get_const_data (file);
parser = NULL;
reader = NULL;
dbus_error_init (&tmp_error);
@@ -100,12 +104,24 @@ bus_config_load (const DBusString *file,
"xmlMemSetup() didn't work for some reason\n");
return NULL;
}
+
+ if (!_dbus_string_init (&dirname))
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ return NULL;
+ }
+
+ if (!_dbus_string_get_dirname (file, &dirname))
+ {
+ dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
+ goto failed;
+ }
- parser = bus_config_parser_new ();
+ parser = bus_config_parser_new (&dirname, is_toplevel, parent);
if (parser == NULL)
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
- return NULL;
+ goto failed;
}
errno = 0;
@@ -163,12 +179,13 @@ bus_config_load (const DBusString *file,
if (!bus_config_parser_finished (parser, error))
goto failed;
-
+ _dbus_string_free (&dirname);
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
return parser;
failed:
_DBUS_ASSERT_ERROR_IS_SET (error);
+ _dbus_string_free (&dirname);
if (parser)
bus_config_parser_unref (parser);
_dbus_assert (reader == NULL); /* must go to reader_out first */