void cbf_free_string (cbf_context *context, const char *string) { void * memblock; memblock = (void *)string; cbf_free (&memblock, NULL); }
int cbf_free_text(const char **old_block, size_t *old_nelem) { void * vold_block; vold_block = (void *)*old_block; cbf_failnez(cbf_free(&vold_block, old_nelem)) *old_block = NULL; return 0; }
int cbf_free_context (cbf_context **context) { int errorcode; errorcode = 0; if (context) if (*context) { if ((*context)->temporary) errorcode = cbf_free_file (&(*context)->temporary); errorcode |= cbf_free ((void **) context, NULL); } /* Success? */ return errorcode; }
int cbf_make_new_node (cbf_node **node, CBF_NODETYPE type, cbf_context *context, const char *name) { int errorcode; if (!node) return CBF_ARGUMENT; /* Create the new node */ cbf_failnez (cbf_alloc ((void **) node, NULL, sizeof (cbf_node), 1)) /* Initialise the node */ (*node)->type = type; (*node)->name = NULL; (*node)->link = NULL; (*node)->parent = NULL; (*node)->children = 0; (*node)->child_size = 0; (*node)->child = NULL; /* Add the context? */ if (type == CBF_LINK) (*node)->context = NULL; else { /* Does the context exist? */ if (context) (*node)->context = context; else (*node)->context = NULL; /* Add a context connection */ cbf_onfailnez (cbf_add_contextconnection (&(*node)->context), cbf_free ((void **) node, NULL)) /* Name the node */ errorcode = cbf_name_new_node (*node, name); if (errorcode) { errorcode |= cbf_free_context (&(*node)->context); return errorcode | cbf_free_node (*node); } } /* Success */ return 0; }