OSSP CVS Repository

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

ossp-pkg/cfg/cfg_node.c 1.1 -> 1.2

--- cfg_node.c   2002/07/03 13:25:34     1.1
+++ cfg_node.c   2002/07/04 06:16:13     1.2
@@ -46,8 +46,7 @@
     n->rbroth   = NULL;
     n->child1   = NULL;
     n->token    = NULL;
-    n->data.t   = CFG_DATA_TYPE_LONG;
-    n->data.u.l = 0;
+    cfg_data_init(&n->data);
     *node = n;
     return CFG_OK;
 }
@@ -81,16 +80,7 @@
             break;
         }
         case CFG_NODE_ATTR_DATA: {
-            node->data.t = (cfg_data_type_t)va_arg(ap, cfg_data_type_t);
-            switch (node->data.t) {
-                case CFG_DATA_TYPE_PTR:    node->data.u.p = (void *)va_arg(ap, void *); break;
-                case CFG_DATA_TYPE_CHAR:   node->data.u.c = (char  )va_arg(ap, int   ); break;
-                case CFG_DATA_TYPE_INT:    node->data.u.i = (int   )va_arg(ap, int   ); break;
-                case CFG_DATA_TYPE_LONG:   node->data.u.l = (long  )va_arg(ap, long  ); break;
-                case CFG_DATA_TYPE_FLOAT:  node->data.u.f = (float )va_arg(ap, double); break;
-                case CFG_DATA_TYPE_DOUBLE: node->data.u.d = (double)va_arg(ap, double); break;
-                default: return CFG_ERR_ARG;
-            }
+            return CFG_ERR_USE;
         }
         default:
             return CFG_ERR_ARG;
@@ -108,22 +98,22 @@
     va_start(ap, attr);
     switch (attr) {
         case CFG_NODE_ATTR_TYPE: {
-            cfg_node_type_t *type = (cfg_node_type_t *)va_arg(ap, cfg_node_type_t *);
+            cfg_node_type_t *type = (cfg_node_type_t *)va_arg(ap, void *);
             *type = node->type;
             break;
         }
         case CFG_NODE_ATTR_PARENT: {
-            cfg_node_t **n = (cfg_node_t **)va_arg(ap, cfg_node_t **);
+            cfg_node_t **n = (cfg_node_t **)va_arg(ap, void *);
             *n = node->parent;
             break;
         }
         case CFG_NODE_ATTR_RBROTH: {
-            cfg_node_t **n = (cfg_node_t **)va_arg(ap, cfg_node_t **);
+            cfg_node_t **n = (cfg_node_t **)va_arg(ap, void *);
             *n = node->rbroth;
             break;
         }
         case CFG_NODE_ATTR_CHILD1: {
-            cfg_node_t **n = (cfg_node_t **)va_arg(ap, cfg_node_t **);
+            cfg_node_t **n = (cfg_node_t **)va_arg(ap, void *);
             *n = node->child1;
             break;
         }
@@ -133,17 +123,9 @@
             break;
         }
         case CFG_NODE_ATTR_DATA: {
-            cfg_data_type_t *type = (cfg_data_type_t *)va_arg(ap, cfg_data_type_t *);
-            *type = node->data.t;
-            switch (node->data.t) {
-                case CFG_DATA_TYPE_PTR:    *((void  **)va_arg(ap, void  **)) = node->data.u.p; break;
-                case CFG_DATA_TYPE_CHAR:   *((char   *)va_arg(ap, int    *)) = node->data.u.c; break;
-                case CFG_DATA_TYPE_INT:    *((int    *)va_arg(ap, int    *)) = node->data.u.i; break;
-                case CFG_DATA_TYPE_LONG:   *((long   *)va_arg(ap, long   *)) = node->data.u.l; break;
-                case CFG_DATA_TYPE_DOUBLE: *((double *)va_arg(ap, double *)) = node->data.u.d; break;
-                case CFG_DATA_TYPE_FLOAT:  *((float  *)va_arg(ap, double *)) = node->data.u.f; break;
-                default: return CFG_ERR_ARG;
-            }
+            cfg_data_t **data = (cfg_data_t **)va_arg(ap, void *);
+            *data = &(node->data);
+            break;
         }
         default:
             return CFG_ERR_ARG;

CVSTrac 2.0.1