Skip to content
Browse files

Added ARC support

  • Loading branch information...
1 parent eab9262 commit 7c655a6b51942179d7a593b88ab7f7c55eb5085d @unixpickle committed Nov 6, 2011
View
26 KBCKit/KBDecodeObjC.m
@@ -46,20 +46,28 @@
uint8_t typeNum = 0;
// read an type, then the object.
if (!kb_decode_read_type(ctx, &typeSub, &typeNum)) {
+#if !__has_feature(objc_arc)
[array release];
+#endif
return nil;
}
if (typeSub == 0) break;
NSObject * nextObject = kb_decode_objc_object(ctx, typeSub);
if (!nextObject) {
+#if !__has_feature(objc_arc)
[array release];
+#endif
return nil;
}
[array addObject:nextObject];
}
// If I were to create an immutable array enclosing this, it
// would take a few more milliseconds... no thanks.
+#if !__has_feature(objc_arc)
return [array autorelease];
+#else
+ return array;
+#endif
}
NSDictionary * kb_decode_objc_dictionary (KBContextRef ctx, uint8_t type) {
@@ -69,7 +77,9 @@
uint8_t typeNum = 0;
char * keyStr = NULL;
if (!kb_decode_dictionary_key(ctx, type, &keyStr)) {
+#if !__has_feature(objc_arc)
[dictionary release];
+#endif
return nil;
}
if (!keyStr) break;
@@ -79,27 +89,39 @@
freeWhenDone:YES];
if (!objKey) {
free(keyStr);
+#if !__has_feature(objc_arc)
[dictionary release];
+#endif
return nil;
}
// read an type, then the object.
if (!kb_decode_read_type(ctx, &type, &typeNum)) {
+#if !__has_feature(objc_arc)
[objKey release];
[dictionary release];
+#endif
return nil;
}
NSObject * nextObject = kb_decode_objc_object(ctx, type);
if (!nextObject) {
+#if !__has_feature(objc_arc)
[objKey release];
[dictionary release];
+#endif
return nil;
}
[dictionary setObject:nextObject forKey:objKey];
+#if !__has_feature(objc_arc)
[objKey release];
+#endif
}
// If I were to create an immutable dictionary enclosing this, it
// would take a few more milliseconds... no thanks.
+#if !__has_feature(objc_arc)
return [dictionary autorelease];
+#else
+ return dictionary;
+#endif
}
NSString * kb_decode_objc_string (KBContextRef ctx, uint8_t type) {
@@ -114,7 +136,11 @@
if (!string) {
free(buffer);
}
+#if !__has_feature(objc_arc)
return [string autorelease];
+#else
+ return string;
+#endif
}
NSNumber * kb_decode_objc_integer (KBContextRef ctx, uint8_t type) {
View
10 KeyedBits.xcodeproj/project.pbxproj
@@ -536,26 +536,28 @@
FAEDCAD314365D79004F8C87 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+ CLANG_ENABLE_OBJC_ARC = NO;
EXECUTABLE_PREFIX = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "LibKBCKit/LibKBCKit-Prefix.pch";
MACOSX_DEPLOYMENT_TARGET = 10.6;
PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = macosx10.6;
+ SDKROOT = macosx10.7;
};
name = Debug;
};
FAEDCAD414365D79004F8C87 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
+ CLANG_ENABLE_OBJC_ARC = NO;
EXECUTABLE_PREFIX = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "LibKBCKit/LibKBCKit-Prefix.pch";
MACOSX_DEPLOYMENT_TARGET = 10.6;
PRODUCT_NAME = "$(TARGET_NAME)";
- SDKROOT = macosx10.6;
+ SDKROOT = macosx10.7;
};
name = Release;
};
View
BIN ....xcodeproj/project.xcworkspace/xcuserdata/alex.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.

0 comments on commit 7c655a6

Please sign in to comment.
Something went wrong with that request. Please try again.