OSSP CVS Repository

ossp - Difference in ossp-pkg/cfg/cfg_node.c versions 1.6 and 1.7
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/cfg/cfg_node.c 1.6 -> 1.7

--- cfg_node.c   2002/07/10 14:46:28     1.6
+++ cfg_node.c   2002/07/10 19:26:32     1.7
@@ -45,10 +45,13 @@
     if ((n = malloc(sizeof(cfg_node_t))) == NULL)
         return CFG_ERR_SYS;
     n->parent   = NULL;
+    n->lbroth   = NULL;
     n->rbroth   = NULL;
     n->child1   = NULL;
     n->type     = CFG_NODE_TYPE_ARG;
     n->token    = NULL;
+    n->name     = NULL;
+    n->offset   = 0;
     cfg_data_init(&n->data);
     *node = n;
     return CFG_OK;
@@ -60,15 +63,36 @@
         return CFG_ERR_ARG;
     if (node->token != NULL)
         free(node->token);
+    if (node->name != NULL)
+        free(node->name);
     free(node);
     return CFG_OK;
 }
 
 cfg_rc_t cfg_node_clone(cfg_t *cfg, cfg_node_t *node, cfg_node_t **node2)
 {
+    cfg_node_t *n;
+
     if (node == NULL || node2 == NULL)
         return CFG_ERR_ARG;
-    /* FIXME */
+    if ((n = malloc(sizeof(cfg_node_t))) == NULL)
+        return CFG_ERR_SYS;
+    n->parent   = node->parent;
+    n->lbroth   = node->lbroth;
+    n->rbroth   = node->rbroth;
+    n->child1   = node->child1;
+    n->type     = node->type;
+    if (node->token != NULL)
+        n->token = strdup(node->token);
+    else
+        n->token = NULL;
+    if (node->name != NULL)
+        n->name = strdup(node->name);
+    else
+        n->name = NULL;
+    n->offset   = node->offset;
+    cfg_data_copy(&node->data, &n->data);
+    *node2 = n;
     return CFG_OK;
 }
 

CVSTrac 2.0.1