summaryrefslogtreecommitdiff
path: root/tikzit/src/common/Shape.m
diff options
context:
space:
mode:
authorJohan Paulsson <gonz@badcode.net>2015-02-25 12:36:17 -0800
committerJohan Paulsson <gonz@badcode.net>2015-02-25 12:36:17 -0800
commitffa99ec96899716ce1084177810303d336f51ff6 (patch)
treef427df60958a456351c73fddd7536bcfa81bc480 /tikzit/src/common/Shape.m
parent8233df2ddd3133618be536c5423cdc6a40b4a20c (diff)
Conversion of common files to ifdef for ARC
Diffstat (limited to 'tikzit/src/common/Shape.m')
-rw-r--r--tikzit/src/common/Shape.m16
1 files changed, 16 insertions, 0 deletions
diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m
index 5dc25e3..e887688 100644
--- a/tikzit/src/common/Shape.m
+++ b/tikzit/src/common/Shape.m
@@ -61,8 +61,12 @@
- (NSSet*)paths {return paths;}
- (void)setPaths:(NSSet *)p {
if (paths != p) {
+#if __has_feature(objc_arc)
+ paths = p;
+#else
[paths release];
paths = [p retain];
+#endif
[self calcBoundingRect];
}
}
@@ -79,9 +83,11 @@
}
- (void)dealloc {
+#if ! __has_feature(objc_arc)
[paths release];
[styleTikz release];
[super dealloc];
+#endif
}
NSDictionary *shapeDictionary = nil;
@@ -101,7 +107,9 @@ NSDictionary *shapeDictionary = nil;
[shapeDir stringByAppendingPathComponent:f]];
if (sh != nil) {
[shapeDict setObject:sh forKey:nm];
+#if ! __has_feature(objc_arc)
[sh release];
+#endif
}
}
}
@@ -122,7 +130,9 @@ NSDictionary *shapeDictionary = nil;
shapes[3], SHAPE_UP_TRIANGLE,
shapes[4], SHAPE_DOWN_TRIANGLE,
nil];
+#if ! __has_feature(objc_arc)
for (int i = 0; i<5; ++i) [shapes[i] release];
+#endif
NSString *systemShapeDir = [[SupportDir systemSupportDir] stringByAppendingPathComponent:@"shapes"];
NSString *userShapeDir = [[SupportDir userSupportDir] stringByAppendingPathComponent:@"shapes"];
@@ -137,7 +147,9 @@ NSDictionary *shapeDictionary = nil;
postNotificationName:@"ShapeDictionaryReplaced"
object:self];
+#if ! __has_feature(objc_arc)
[oldShapeDictionary release];
+#endif
}
+ (NSDictionary*)shapeDictionary {
@@ -147,7 +159,11 @@ NSDictionary *shapeDictionary = nil;
+ (Shape*)shapeForName:(NSString*)shapeName {
Shape *s = [[[self shapeDictionary] objectForKey:shapeName] copy];
+#if __has_feature(objc_arc)
+ return s;
+#else
return [s autorelease];
+#endif
}
@end