XML node ownership fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@8564 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2001-01-12 06:56:36 +00:00
parent c32e845f44
commit 9804becce4
2 changed files with 26 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2001-01-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSXML.m: ([-GSXMLDocument setRoot:]) set root node to be
owned by libxml, so we don't free it's memory ourselves.
2001-01-10 Nicola Pero <n.pero@mi.flashnet.it> 2001-01-10 Nicola Pero <n.pero@mi.flashnet.it>
* Source/GSAttributedString.m ([GSAttributedString -length]), * Source/GSAttributedString.m ([GSAttributedString -length]),

View file

@ -91,8 +91,16 @@ setupCache()
static xmlParserInputPtr static xmlParserInputPtr
loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctxt); loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctxt);
/* Internal interfaces */ /* Internal interfaces */
@interface GSXMLNamespace (GSPrivate)
- (void) _native: (BOOL)value;
@end
@interface GSXMLNode (GSPrivate)
- (void) _native: (BOOL)value;
@end
@interface GSXMLParser (Private) @interface GSXMLParser (Private)
- (BOOL) _initLibXML; - (BOOL) _initLibXML;
- (void) _parseChunk: (NSData*)data; - (void) _parseChunk: (NSData*)data;
@ -176,6 +184,8 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctxt);
{ {
void *nodeLib = [node lib]; void *nodeLib = [node lib];
void *oldRoot = xmlDocSetRootElement(lib, nodeLib); void *oldRoot = xmlDocSetRootElement(lib, nodeLib);
[node _native: NO];
return oldRoot == NULL ? nil : [GSXMLNode nodeFrom: nodeLib]; return oldRoot == NULL ? nil : [GSXMLNode nodeFrom: nodeLib];
} }
@ -378,13 +388,9 @@ loadEntityFunction(const char *url, const char *eid, xmlParserCtxtPtr *ctxt);
@end @end
/* Internal interface for GSXMLNamespace */
@interface GSXMLNamespace (internal)
- (void) native: (BOOL)value;
@end
@implementation GSXMLNamespace (Internal) @implementation GSXMLNamespace (GSPrivate)
- (void) native: (BOOL)value - (void) _native: (BOOL)value
{ {
native = value; native = value;
} }
@ -451,7 +457,7 @@ static NSMapTable *nodeNames = 0;
{ {
if (ns != nil) if (ns != nil)
{ {
[ns native: NO]; [ns _native: NO];
lib = xmlNewNode((xmlNsPtr)[ns lib], [name cString]); lib = xmlNewNode((xmlNsPtr)[ns lib], [name cString]);
} }
else else
@ -718,6 +724,13 @@ static NSMapTable *nodeNames = 0;
@end @end
@implementation GSXMLNode (GSPrivate)
- (void) _native: (BOOL)value
{
native = value;
}
@end
/* /*