From ffa99ec96899716ce1084177810303d336f51ff6 Mon Sep 17 00:00:00 2001 From: Johan Paulsson Date: Wed, 25 Feb 2015 12:36:17 -0800 Subject: Conversion of common files to ifdef for ARC --- tikzit/src/common/Node.m | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'tikzit/src/common/Node.m') diff --git a/tikzit/src/common/Node.m b/tikzit/src/common/Node.m index 8c64b6b..c5b11d1 100644 --- a/tikzit/src/common/Node.m +++ b/tikzit/src/common/Node.m @@ -50,11 +50,13 @@ } - (void)dealloc { +#if ! __has_feature(objc_arc) [name release]; [style release]; [data release]; [label release]; [super dealloc]; +#endif } - (Shape*) shape { @@ -67,7 +69,11 @@ - (Transformer*) shapeTransformerFromTransformer:(Transformer*)t { // we take a copy to keep the reflection attributes +#if ! __has_feature(objc_arc) Transformer *transformer = [[t copy] autorelease]; +#else + Transformer *transformer = [t copy]; +#endif NSPoint screenPos = [t toScreen:point]; [transformer setOrigin:screenPos]; float scale = [t scale]; @@ -101,7 +107,11 @@ } - (BOOL)attachStyleFromTable:(NSArray*)styles { - NSString *style_name = [[[data propertyForKey:@"style"] retain] autorelease]; +#if __has_feature(objc_arc) + NSString *style_name = [data propertyForKey:@"style"]; +#else + NSString *style_name = [[[data propertyForKey:@"style"] retain] autorelease]; +#endif [self setStyle:nil]; @@ -137,11 +147,19 @@ } + (Node*)nodeWithPoint:(NSPoint)p { - return [[[Node alloc] initWithPoint:p] autorelease]; +#if __has_feature(objc_arc) + return [[Node alloc] initWithPoint:p]; +#else + return [[[Node alloc] initWithPoint:p] autorelease]; +#endif } + (Node*)node { - return [[[Node alloc] init] autorelease]; +#if __has_feature(objc_arc) + return [[Node alloc] init]; +#else + return [[[Node alloc] init] autorelease]; +#endif } @@ -180,9 +198,13 @@ - (void)setStyle:(NodeStyle *)st { if (style != st) { - NodeStyle *oldStyle = style; - style = [st retain]; - [oldStyle release]; +#if __has_feature(objc_arc) + style = st; +#else + NodeStyle *oldStyle = style; + style = [st retain]; + [oldStyle release]; +#endif } [self updateData]; } -- cgit v1.2.3