OSSP CVS Repository

ossp - Check-in [2302]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2302
Date: 2002-Jul-17 16:39:57 (local)
2002-Jul-17 14:39:57 (UTC)
User:rse
Branch:
Comment: now finally use the grid allocator for the tree nodes
Tickets:
Inspections:
Files:
ossp-pkg/cfg/cfg_node.c      1.10 -> 1.11     7 inserted, 5 deleted

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

--- cfg_node.c   2002/07/17 14:35:09     1.10
+++ cfg_node.c   2002/07/17 14:39:57     1.11
@@ -39,11 +39,12 @@
 cfg_rc_t cfg_node_create(cfg_t *cfg, cfg_node_t **node)
 {
     cfg_node_t *n;
+    cfg_rc_t rc;
 
     if (node == NULL)
         return CFG_ERR_ARG;
-    if ((n = malloc(sizeof(cfg_node_t))) == NULL)
-        return CFG_ERR_SYS;
+    if ((rc = cfg_grid_alloc(cfg->grid_nodes, (void **)&n)) != CFG_OK)
+        return rc;
     n->parent   = NULL;
     n->lbroth   = NULL;
     n->rbroth   = NULL;
@@ -65,18 +66,19 @@
         free(node->token);
     if (node->srcname != NULL)
         free(node->srcname);
-    free(node);
+    cfg_grid_free(cfg->grid_nodes, 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;
+    cfg_rc_t rc;
 
     if (node == NULL || node2 == NULL)
         return CFG_ERR_ARG;
-    if ((n = malloc(sizeof(cfg_node_t))) == NULL)
-        return CFG_ERR_SYS;
+    if ((rc = cfg_grid_alloc(cfg->grid_nodes, (void **)&n)) != CFG_OK)
+        return rc;
     n->parent   = node->parent;
     n->lbroth   = node->lbroth;
     n->rbroth   = node->rbroth;

CVSTrac 2.0.1