dbus/bus config-parser.c,1.31,1.32 config-loader-libxml.c,1.6,1.7

Olivier Andrieu oandrieu at freedesktop.org
Sat Jul 31 11:28:12 PDT 2004


Update of /cvs/dbus/dbus/bus
In directory pdx:/tmp/cvs-serv19531/bus

Modified Files:
	config-parser.c config-loader-libxml.c 
Log Message:
* bus/config-parser.c (bus_config_parser_new): fix an invalid _unref
in the SELinux support.

* doc/busconfig.dtd: update DTD for SELinux support.

* bus/config-loader-libxml.c: fix error handler and parser
initialisation/cleanup. OOM test now works with libxml2 HEAD.

* configure.in: remove the warning about libxml2

* dbus/dbus-bus.c: silence doxygen warning.


Index: config-parser.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/config-parser.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- config-parser.c	30 Jul 2004 05:59:34 -0000	1.31
+++ config-parser.c	31 Jul 2004 18:28:10 -0000	1.32
@@ -346,9 +346,6 @@
       
       _dbus_string_free (&parser->basedir);
 
-      if (parser->service_sid_table == NULL)
-        _dbus_hash_table_unref (parser->service_sid_table);
-      
       dbus_free (parser);
       return NULL;
     }

Index: config-loader-libxml.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/config-loader-libxml.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- config-loader-libxml.c	29 Jul 2004 08:00:45 -0000	1.6
+++ config-loader-libxml.c	31 Jul 2004 18:28:10 -0000	1.7
@@ -122,13 +122,12 @@
                  xml_error->code, xml_error->message);
 #endif
 
-  if (!dbus_error_is_set (error) && 
-      (xml_error->level == XML_ERR_ERROR ||
-       xml_error->level == XML_ERR_FATAL))
+  if (!dbus_error_is_set (error))
     {
-      if (xml_error->code != XML_ERR_NO_MEMORY)
+      if (xml_error->code == XML_ERR_NO_MEMORY)
         _DBUS_SET_OOM (error);
-      else
+      else if (xml_error->level == XML_ERR_ERROR ||
+               xml_error->level == XML_ERR_FATAL)
         dbus_set_error (error, DBUS_ERROR_FAILED,
                         "Error loading config file: '%s'",
                         xml_error->message);
@@ -146,7 +145,6 @@
   xmlTextReader *reader;
   BusConfigParser *parser;
   DBusString dirname, data;
-  const char *data_str;
   DBusError tmp_error;
   int ret;
   
@@ -155,17 +153,6 @@
   parser = NULL;
   reader = NULL;
 
-  if (is_toplevel)
-    {
-      /* xmlMemSetup only fails if one of the functions is NULL */
-      xmlMemSetup (dbus_free,
-                   dbus_malloc,
-                   dbus_realloc,
-                   _dbus_strdup);
-      xmlInitParser ();
-      xmlSetGenericErrorFunc (NULL, xml_shut_up);
-    }
-
   if (!_dbus_string_init (&dirname))
     {
       _DBUS_SET_OOM (error);
@@ -179,6 +166,17 @@
       return NULL;
     }
 
+  if (is_toplevel)
+    {
+      /* xmlMemSetup only fails if one of the functions is NULL */
+      xmlMemSetup (dbus_free,
+                   dbus_malloc,
+                   dbus_realloc,
+                   _dbus_strdup);
+      xmlInitParser ();
+      xmlSetGenericErrorFunc (NULL, xml_shut_up);
+    }
+
   if (!_dbus_string_get_dirname (file, &dirname))
     {
       _DBUS_SET_OOM (error);
@@ -195,9 +193,8 @@
   if (!_dbus_file_get_contents (&data, file, error))
     goto failed;
 
-  data_str = _dbus_string_get_const_data (&data);
-
-  reader = xmlReaderForMemory (data_str, _dbus_string_get_length (&data),
+  reader = xmlReaderForMemory (_dbus_string_get_const_data (&data), 
+                               _dbus_string_get_length (&data),
 			       NULL, NULL, 0);
   if (reader == NULL)
     {
@@ -295,8 +292,6 @@
 
  reader_out:
   xmlFreeTextReader (reader);
-  if (is_toplevel)
-    xmlCleanupParser(); 
   reader = NULL;
   if (dbus_error_is_set (&tmp_error))
     {
@@ -308,6 +303,8 @@
     goto failed;
   _dbus_string_free (&dirname);
   _dbus_string_free (&data);
+  if (is_toplevel)
+    xmlCleanupParser();
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   return parser;
   
@@ -315,6 +312,8 @@
   _DBUS_ASSERT_ERROR_IS_SET (error);
   _dbus_string_free (&dirname);
   _dbus_string_free (&data);
+  if (is_toplevel)
+    xmlCleanupParser();
   if (parser)
     bus_config_parser_unref (parser);
   _dbus_assert (reader == NULL); /* must go to reader_out first */



More information about the dbus-commit mailing list