OSSP CVS Repository

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

ossp-pkg/cfg/cfg_syn.c 1.10 -> 1.11

--- cfg_syn.c    2002/07/08 13:45:13     1.10
+++ cfg_syn.c    2002/07/10 12:00:23     1.11
@@ -168,6 +168,7 @@
 }
 
 typedef struct {
+    cfg_t *cfg;
     cfg_buf_t *buf;
     int indent;
 } export_t;
@@ -267,33 +268,33 @@
     cfg_rc_t rc;
     char *token;
 
-    rc = cfg_node_get(node, CFG_NODE_ATTR_TYPE, &type);
+    rc = cfg_node_get(ctx->cfg, node, CFG_NODE_ATTR_TYPE, &type);
     if (type == CFG_NODE_TYPE_SEQ) {
         export_format(ctx, "{\n");
         export_indent(ctx, 1);
-        cfg_node_goto(node, CFG_NODE_GOTO_CHILD1, &node2);
+        cfg_node_get(ctx->cfg, node, CFG_NODE_ATTR_CHILD1, &node2);
         while (node2 != NULL) {
             export_node(ctx, node2);
-            cfg_node_goto(node2, CFG_NODE_GOTO_RBROTH, &node2);
+            cfg_node_get(ctx->cfg, node2, CFG_NODE_ATTR_RBROTH, &node2);
         }
         export_indent(ctx, -1);
         export_format(ctx, "}");
     }
     else if (type == CFG_NODE_TYPE_DIR) {
-        cfg_node_goto(node, CFG_NODE_GOTO_CHILD1, &node2);
+        cfg_node_get(ctx->cfg, node, CFG_NODE_ATTR_CHILD1, &node2);
         while (node2 != NULL) {
             export_node(ctx, node2);
-            cfg_node_goto(node2, CFG_NODE_GOTO_RBROTH, &node2);
+            cfg_node_get(ctx->cfg, node2, CFG_NODE_ATTR_RBROTH, &node2);
             if (node2 != NULL)
                 export_format(ctx, " ");
         }
-        cfg_node_goto(node, CFG_NODE_GOTO_RBROTH, &node2);
+        cfg_node_get(ctx->cfg, node, CFG_NODE_ATTR_RBROTH, &node2);
         if (node2 != NULL)
             export_format(ctx, ";");
         export_format(ctx, "\n");
     }
-    else if (type == CFG_NODE_TYPE_TOK) {
-        cfg_node_get(node, CFG_NODE_ATTR_TOKEN, &token);
+    else if (type == CFG_NODE_TYPE_ARG) {
+        cfg_node_get(ctx->cfg, node, CFG_NODE_ATTR_TOKEN, &token);
         if (token != NULL)
             export_token(ctx, token);
         else
@@ -316,15 +317,16 @@
     if ((rc = cfg_buf_create(&buf)) != CFG_OK)
         return rc;
 
+    ctx.cfg    = cfg;
     ctx.buf    = buf;
     ctx.indent = 0;
 
     /* first SEQ node is special, so expand it manually instead
        of just calling once export_node(&ctx, node); */
-    cfg_node_goto(node, CFG_NODE_GOTO_CHILD1, &node);
+    cfg_node_get(cfg, node, CFG_NODE_ATTR_CHILD1, &node);
     while (node != NULL) {
         export_node(&ctx, node);
-        cfg_node_goto(node, CFG_NODE_GOTO_RBROTH, &node);
+        cfg_node_get(cfg, node, CFG_NODE_ATTR_RBROTH, &node);
     }
 
     cfg_buf_content(buf, output, NULL, NULL);
@@ -333,15 +335,15 @@
     return CFG_OK;
 }
 
-static cfg_rc_t cfg_syn_destroy_node(cfg_node_t *node)
+static cfg_rc_t cfg_syn_destroy_node(cfg_t *cfg, cfg_node_t *node)
 {
     if (node == NULL)
         return CFG_ERR_ARG;
     if (node->child1 != NULL)
-        cfg_syn_destroy_node(node->child1);
+        cfg_syn_destroy_node(cfg, node->child1);
     if (node->rbroth != NULL)
-        cfg_syn_destroy_node(node->rbroth);
-    cfg_node_destroy(node);
+        cfg_syn_destroy_node(cfg, node->rbroth);
+    cfg_node_destroy(cfg, node);
     return CFG_OK;
 }
 
@@ -349,7 +351,7 @@
 {
     if (node == NULL)
         return CFG_ERR_ARG;
-    cfg_syn_destroy_node(node);
+    cfg_syn_destroy_node(cfg, node);
     return CFG_OK;
 }
 

CVSTrac 2.0.1