***********************
** FILE NAME : configuration.cpp
** SYSTEM NAME : AXE - Andromeda X-windows Encapsulation
-** VERSION NUMBER : $Revision: 1.2 $
+** VERSION NUMBER : $Revision: 1.3 $
**
** DESCRIPTION : Implementation of configuration class
**
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Jul 23, 2002
-** LAST UPDATE : Jul 24, 2002
+** LAST UPDATE : Nov 02, 2002
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: configuration.cpp,v $
- Revision 1.2 2002-09-28 06:48:46 arjen
+ Revision 1.3 2002-11-02 14:35:15 arjen
+ Uses the XML2 library
+ BugFix: segfault when finding a parameters that is not in the user-sepcific
+ config tree.
+
+ Revision 1.2 2002/09/28 06:48:46 arjen
Bugfix: In configuration::find_parameter(), check if the parameter node exists
before retrieving its contents.
*****************************/
-static const char *RCSID = "$Id: configuration.cpp,v 1.2 2002-09-28 06:48:46 arjen Exp $";
+static const char *RCSID = "$Id: configuration.cpp,v 1.3 2002-11-02 14:35:15 arjen Exp $";
#include "configuration.h"
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
-** LAST MODIFIED : Jul 24, 2002
+** LAST MODIFIED : Nov 02, 2002
**=========================================================================
*/
if (system)
{
root_node = xmlDocGetRootElement(system);
- section_node = xmlFindTag(root_node->childs, section);
+ section_node = xmlFindTag(root_node->children, section);
if (section_node != NULL)
{
- param_node = xmlFindTag(section_node->childs, parameter);
+ param_node = xmlFindTag(section_node->children, parameter);
if (param_node != NULL)
{
- param_node = param_node->childs;
+ param_node = param_node->children;
}
if (param_node != NULL)
{
if (user)
{
root_node = xmlDocGetRootElement(user);
- section_node = xmlFindTag(root_node->childs, section);
+ section_node = xmlFindTag(root_node->children, section);
if (section_node != NULL)
{
- param_node = xmlFindTag(section_node->childs, parameter);
- param_node = param_node->childs;
+ param_node = xmlFindTag(section_node->children, parameter);
+ if (param_node != NULL)
+ {
+ param_node = param_node->children;
+ }
if (param_node != NULL)
{
param_value = (char *)param_node->content;