Permalink
Browse files

Merge branch 'arc'

  • Loading branch information...
robbiehanson committed Dec 23, 2011
2 parents 1a8ae62 + 3ecb7c3 commit 825604827f6a38a21ea546f2eb31aeb33b78108c
@@ -1,5 +1,8 @@
#import "NSString+DDXML.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
@implementation NSString (DDXML)
@@ -17,12 +20,11 @@ - (NSString *)stringByTrimming
- (NSString *)stringByTrimming
{
NSMutableString *mStr = [self mutableCopy];
- CFStringTrimWhitespace((CFMutableStringRef)mStr);
+ CFStringTrimWhitespace((__bridge CFMutableStringRef)mStr);
NSString *result = [mStr copy];
- [mStr release];
- return [result autorelease];
+ return result;
}
#endif
View
@@ -1,6 +1,10 @@
#import "DDXMLPrivate.h"
#import "NSString+DDXML.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
/**
* Welcome to KissXML.
*
@@ -27,7 +31,7 @@ @implementation DDXMLDocument
**/
+ (id)nodeWithDocPrimitive:(xmlDocPtr)doc owner:(DDXMLNode *)owner
{
- return [[[DDXMLDocument alloc] initWithDocPrimitive:doc owner:owner] autorelease];
+ return [[DDXMLDocument alloc] initWithDocPrimitive:doc owner:owner];
}
- (id)initWithDocPrimitive:(xmlDocPtr)doc owner:(DDXMLNode *)inOwner
@@ -49,7 +53,6 @@ - (id)initWithPrimitive:(xmlKindPtr)kindPtr owner:(DDXMLNode *)inOwner
// Promote initializers which use proper parameter types to enable compiler to catch more mistakes.
NSAssert(NO, @"Use initWithDocPrimitive:owner:");
- [self release];
return nil;
}
@@ -78,7 +81,6 @@ - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)err
{
if (error) *error = [NSError errorWithDomain:@"DDXMLErrorDomain" code:0 userInfo:nil];
- [self release];
return nil;
}
@@ -94,7 +96,6 @@ - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)err
{
if (error) *error = [NSError errorWithDomain:@"DDXMLErrorDomain" code:1 userInfo:nil];
- [self release];
return nil;
}
View
@@ -1,6 +1,10 @@
#import "DDXMLPrivate.h"
#import "NSString+DDXML.h"
+#if ! __has_feature(objc_arc)
+#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
+#endif
+
/**
* Welcome to KissXML.
*
@@ -27,7 +31,7 @@ @implementation DDXMLElement
**/
+ (id)nodeWithElementPrimitive:(xmlNodePtr)node owner:(DDXMLNode *)owner
{
- return [[[DDXMLElement alloc] initWithElementPrimitive:node owner:owner] autorelease];
+ return [[DDXMLElement alloc] initWithElementPrimitive:node owner:owner];
}
- (id)initWithElementPrimitive:(xmlNodePtr)node owner:(DDXMLNode *)inOwner
@@ -49,7 +53,6 @@ - (id)initWithPrimitive:(xmlKindPtr)kindPtr owner:(DDXMLNode *)inOwner
// Promote initializers which use proper parameter types to enable compiler to catch more mistakes.
NSAssert(NO, @"Use initWithElementPrimitive:owner:");
- [self release];
return nil;
}
@@ -60,7 +63,6 @@ - (id)initWithName:(NSString *)name
xmlNodePtr node = xmlNewNode(NULL, [name xmlChar]);
if (node == NULL)
{
- [self release];
return nil;
}
@@ -74,7 +76,6 @@ - (id)initWithName:(NSString *)name URI:(NSString *)URI
xmlNodePtr node = xmlNewNode(NULL, [name xmlChar]);
if (node == NULL)
{
- [self release];
return nil;
}
@@ -91,7 +92,6 @@ - (id)initWithName:(NSString *)name stringValue:(NSString *)string
xmlNodePtr node = xmlNewNode(NULL, [name xmlChar]);
if (node == NULL)
{
- [self release];
return nil;
}
@@ -106,16 +106,13 @@ - (id)initWithXMLString:(NSString *)string error:(NSError **)error
DDXMLDocument *doc = [[DDXMLDocument alloc] initWithXMLString:string options:0 error:error];
if (doc == nil)
{
- [self release];
return nil;
}
DDXMLElement *result = [doc rootElement];
[result detach];
- [doc release];
- [self release];
- return [result retain];
+ return result;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -326,8 +323,7 @@ - (void)addAttribute:(DDXMLNode *)attribute
xmlAddChild((xmlNodePtr)genericPtr, (xmlNodePtr)attribute->genericPtr);
// The attribute is now part of the xml tree heirarchy
- [attribute->owner release];
- attribute->owner = [self retain];
+ attribute->owner = self;
}
- (void)removeAttributeForName:(NSString *)name
@@ -476,8 +472,7 @@ - (void)_addNamespace:(DDXMLNode *)namespace
}
// The namespace is now part of the xml tree heirarchy
- [namespace->owner release];
- namespace->owner = [self retain];
+ namespace->owner = self;
if ([namespace isKindOfClass:[DDXMLNamespaceNode class]])
{
@@ -710,8 +705,7 @@ - (void)addChild:(DDXMLNode *)child
xmlAddChild((xmlNodePtr)genericPtr, (xmlNodePtr)child->genericPtr);
// The node is now part of the xml tree heirarchy
- [child->owner release];
- child->owner = [self retain];
+ child->owner = self;
}
- (void)insertChild:(DDXMLNode *)child atIndex:(NSUInteger)index
@@ -737,8 +731,7 @@ - (void)insertChild:(DDXMLNode *)child atIndex:(NSUInteger)index
{
xmlAddPrevSibling(childNodePtr, (xmlNodePtr)child->genericPtr);
- [child->owner release];
- child->owner = [self retain];
+ child->owner = self;
return;
}
@@ -752,8 +745,7 @@ - (void)insertChild:(DDXMLNode *)child atIndex:(NSUInteger)index
{
xmlAddChild((xmlNodePtr)genericPtr, (xmlNodePtr)child->genericPtr);
- [child->owner release];
- child->owner = [self retain];
+ child->owner = self;
return;
}
Oops, something went wrong.

0 comments on commit 8256048

Please sign in to comment.