Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

tc_destroy.c

Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 2005 by Kevin L. Mitchell <klmitch@mit.edu>
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 **
00018 ** @(#)$Id: tc_destroy.c,v 1.3 2005/06/07 04:53:50 klmitch Exp $
00019 */
00027 #include <errno.h>
00028 
00029 #include "treeconf_int.h"
00030 
00031 RCSTAG("@(#)$Id: tc_destroy.c,v 1.3 2005/06/07 04:53:50 klmitch Exp $");
00032 
00033 unsigned int
00034 tc_destroy(treeconf_ctx_t *ctx)
00035 {
00036   treeconf_node_t *node;
00037 
00038   initialize_trcf_error_table();
00039 
00040   /* verify the argument */
00041   if (!tx_verify(ctx))
00042     return EINVAL;
00043 
00044   /* OK, go through all the nodes and release them and their children */
00045   while ((node = ctx->tx_config)) { /* walk the list... */
00046     ctx->tx_config = node->tn_next; /* shift the node up some... */
00047 
00048     _tc_release_node(node); /* release node and all its children */
00049   }
00050 
00051   ctx->tx_count = 0; /* make sure the count is zeroed */
00052   ctx->tx_magic = 0; /* and clear the magic number */
00053 
00054   return 0;
00055 }

Generated on Wed Jun 8 09:18:27 2005 for treeconf by  doxygen 1.3.9.1