Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Dec 19, 2024
2 parents 5a150d8 + 1f0bac2 commit 546ca94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Source/NSXMLDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ - (void) setRootElement: (NSXMLNode*)root

// FIXME: Should we use addChild: here?
xmlDocSetRootElement(internal->node.doc, [root _node]);
if (root->detached)
if (GSIVar(root, detached))
{
xmlFreeDoc(root->detached);
root->detached = 0;
xmlFreeDoc(GSIVar(root, detached));
GSIVar(root, detached) = 0;
}

// Do our subNode housekeeping...
Expand Down
20 changes: 10 additions & 10 deletions Source/NSXMLNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ - (void) _insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index

if (ensure_oldNs(parentNode))
{
detached = parentNode->doc;
internal->detached = parentNode->doc;
}

ns = tmp->oldNs;
Expand Down Expand Up @@ -641,9 +641,9 @@ - (void) _insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
#else
xmlSetTreeDoc(childNode, parentNode->doc);
#endif
if (tmp == child->detached)
if (tmp == GSIVar(child, detached))
{
child->detached = 0;
GSIVar(child, detached) = 0;
}
xmlFreeDoc(tmp);
}
Expand Down Expand Up @@ -1308,19 +1308,19 @@ - (void) detach
{
if (theNode->doc)
{
if (theNode->doc == detached)
if (theNode->doc == internal->detached)
{
return; // Already detached.
}
/* Create a private document and move the node over.
* This is needed so that the strings of the nodes subtree
* get stored in the dictionary of this new document.
*/
detached = xmlNewDoc((xmlChar *)"1.0");
internal->detached = xmlNewDoc((xmlChar *)"1.0");

#if LIBXML_VERSION >= 20620
xmlDOMWrapAdoptNode(NULL, theNode->doc, theNode, detached,
NULL, 0);
xmlDOMWrapAdoptNode(NULL, theNode->doc, theNode,
internal->detached, NULL, 0);
#else
xmlSetTreeDoc(theNode, detached);
#endif
Expand Down Expand Up @@ -1753,7 +1753,7 @@ - (NSXMLDocument*) rootDocument
// but we don't want to return this.
return nil;
}
if (theNode->doc == detached)
if (theNode->doc == internal->detached)
{
return nil; // the document is private from when we detached
}
Expand Down Expand Up @@ -1849,7 +1849,7 @@ - (void) setName: (NSString *)name

if (ensure_oldNs(theNode))
{
detached = theNode->doc;
internal->detached = theNode->doc;
}

// Fake the name space and fix it later
Expand Down Expand Up @@ -1982,7 +1982,7 @@ - (void) setURI: (NSString*)URI

if (ensure_oldNs(theNode))
{
detached = theNode->doc;
internal->detached = theNode->doc;
}

// Fake the name space and fix it later
Expand Down
2 changes: 1 addition & 1 deletion Source/NSXMLPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ union\
NSUInteger options; \
id objectValue; \
NSMutableArray *subNodes; \
xmlDoc *detached;
xmlDoc *detached; \


/* When using the non-fragile ABI, the instance variables are exposed to the
Expand Down

0 comments on commit 546ca94

Please sign in to comment.