xmlfree.c.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. xmlfree.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='xmlelement.c.html' title=' xmlelement.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='xmlnode.c.html' title=' xmlnode.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * NODE * xmlfree (NODE * node);
  24. *
  25. * node.h
  26. *
  27. * recursively free child nodes; minimize recursion by following
  28. * node-&gt;after at each level;
  29. *
  30. * the caller must free the root node; this allows that the root
  31. * to be statically declared, if desired;
  32. *
  33. * Motley Tools by Charles Maier &lt;cmaier@cmassoc.net&gt;;
  34. * Copyright (c) 2001-2006 by Charles Maier Associates;
  35. * Licensed under the Internet Software Consortium License;
  36. *
  37. *--------------------------------------------------------------------*/
  38. #ifndef XMLFREE_SOURCE
  39. #define XMLFREE_SOURCE
  40. #include &lt;stdlib.h&gt;
  41. #include &lt;memory.h&gt;
  42. #include &quot;../nodes/node.h&quot;
  43. void xmlfree (NODE * node)
  44. {
  45. if (node)
  46. {
  47. node = node-&gt;below;
  48. }
  49. while (node)
  50. {
  51. NODE * temp = node;
  52. if (node-&gt;above)
  53. {
  54. node-&gt;above-&gt;below = (NODE *)(0);
  55. }
  56. if (node-&gt;prior)
  57. {
  58. node-&gt;prior-&gt;after = (NODE *)(0);
  59. }
  60. xmlfree (node);
  61. node = node-&gt;after;
  62. free (temp);
  63. }
  64. return;
  65. }
  66. #endif
  67. </pre>
  68. <div class='footerlink'>
  69. [<a href='xmlelement.c.html' title=' xmlelement.c '>PREV</a>]
  70. [<a href='toolkit.html' title=' Index '>HOME</a>]
  71. [<a href='xmlnode.c.html' title=' xmlnode.c '>NEXT</a>]
  72. </div>
  73. </body>
  74. </html>