use clearPrivatePointers() in NSXMLDocument as well as NSXMLNode when copying

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34518 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2012-01-14 02:43:18 +00:00
parent 990bd6274c
commit f6289a65a1
2 changed files with 16 additions and 13 deletions

View file

@ -29,6 +29,17 @@
#import "GSInternal.h"
GS_PRIVATE_INTERNAL(NSXMLNode)
void clearPrivatePointers(xmlNodePtr aNode)
{
if (!aNode)
return;
aNode->_private = NULL;
clearPrivatePointers(aNode->children);
clearPrivatePointers(aNode->next);
if (aNode->type == XML_ELEMENT_NODE)
clearPrivatePointers((xmlNodePtr)(aNode->properties));
}
// Private methods to manage libxml pointers...
@interface NSXMLNode (Private)
- (void *) _node;
@ -340,17 +351,6 @@ GS_PRIVATE_INTERNAL(NSXMLNode)
return childrenArray;
}
static void clearPrivatePointers(xmlNodePtr aNode)
{
if (!aNode)
return;
aNode->_private = NULL;
clearPrivatePointers(aNode->children);
clearPrivatePointers(aNode->next);
if (aNode->type == XML_ELEMENT_NODE)
clearPrivatePointers((xmlNodePtr)(aNode->properties));
}
- (id) copyWithZone: (NSZone*)zone
{
id c = [[self class] allocWithZone: zone];