Permalink
Browse files

Preparing for ARC using JXArcCompatibilityMacros.

  • Loading branch information...
1 parent dbe7768 commit fda8aa41fbdfe7abd5b707bb32b4946647f5a601 @JanX2 committed Feb 25, 2013
View
2 DiffMatchPatch.h
@@ -77,7 +77,7 @@ typedef enum {
NSUInteger length2;
}
-@property (nonatomic, retain) NSMutableArray *diffs;
+@property (nonatomic, strong) NSMutableArray *diffs;
@property (nonatomic, assign) NSUInteger start1;
@property (nonatomic, assign) NSUInteger start2;
@property (nonatomic, assign) NSUInteger length1;
View
187 DiffMatchPatch.m
@@ -26,6 +26,7 @@
#import "NSString+UriCompatibility.h"
#import "NSMutableDictionary+DMPExtensions.h"
#import "DiffMatchPatchCFUtilities.h"
+#import "JXArcCompatibilityMacros.h"
#if !defined(MAX_OF_CONST_AND_DIFF)
@@ -62,7 +63,7 @@ @implementation Diff
+ (id)diffWithOperation:(Operation)anOperation
andText:(NSString *)aText;
{
- return [[[self alloc] initWithOperation:anOperation andText:aText] autorelease];
+ return JX_AUTORELEASE([[self alloc] initWithOperation:anOperation andText:aText]);
}
- (id)initWithOperation:(Operation)anOperation
@@ -77,12 +78,14 @@ - (id)initWithOperation:(Operation)anOperation
}
+#if (JX_HAS_ARC == 0)
- (void)dealloc
{
self.text = nil;
[super dealloc];
}
+#endif
- (id)copyWithZone:(NSZone *)zone
{
@@ -179,18 +182,20 @@ - (id)init
return self;
}
+#if (JX_HAS_ARC == 0)
- (void)dealloc
{
self.diffs = nil;
[super dealloc];
}
+#endif
- (id)copyWithZone:(NSZone *)zone
{
Patch *newPatch = [[[self class] allocWithZone:zone] init];
- newPatch.diffs = [[[NSMutableArray alloc] initWithArray:self.diffs copyItems:YES] autorelease];
+ newPatch.diffs = JX_AUTORELEASE([[NSMutableArray alloc] initWithArray:self.diffs copyItems:YES]);
newPatch.start1 = self.start1;
newPatch.start2 = self.start2;
newPatch.length1 = self.length1;
@@ -285,10 +290,12 @@ - (id)init
return self;
}
+#if 0
- (void)dealloc
{
[super dealloc];
}
+#endif
#pragma mark Diff Functions
@@ -368,13 +375,13 @@ - (NSMutableArray *)diff_mainOfOldString:(NSString *)text1
}
// Trim off common prefix (speedup).
- NSUInteger commonlength = (NSUInteger)diff_commonPrefix((CFStringRef)text1, (CFStringRef)text2);
+ NSUInteger commonlength = (NSUInteger)diff_commonPrefix(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2));
NSString *commonprefix = [text1 substringToIndex:commonlength];
text1 = [text1 substringFromIndex:commonlength];
text2 = [text2 substringFromIndex:commonlength];
// Trim off common suffix (speedup).
- commonlength = (NSUInteger)diff_commonSuffix((CFStringRef)text1, (CFStringRef)text2);
+ commonlength = (NSUInteger)diff_commonSuffix(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2));
NSString *commonsuffix = [text1 substringFromIndex:text1.length - commonlength];
text1 = [text1 substringToIndex:(text1.length - commonlength)];
text2 = [text2 substringToIndex:(text2.length - commonlength)];
@@ -403,7 +410,7 @@ - (NSMutableArray *)diff_mainOfOldString:(NSString *)text1
- (NSUInteger)diff_commonPrefixOfFirstString:(NSString *)text1
andSecondString:(NSString *)text2;
{
- return (NSUInteger)diff_commonPrefix((CFStringRef)text1, (CFStringRef)text2);
+ return (NSUInteger)diff_commonPrefix(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2));
}
/**
@@ -415,7 +422,7 @@ - (NSUInteger)diff_commonPrefixOfFirstString:(NSString *)text1
- (NSUInteger)diff_commonSuffixOfFirstString:(NSString *)text1
andSecondString:(NSString *)text2;
{
- return (NSUInteger)diff_commonSuffix((CFStringRef)text1, (CFStringRef)text2);
+ return (NSUInteger)diff_commonSuffix(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2));
}
/**
@@ -428,7 +435,7 @@ - (NSUInteger)diff_commonSuffixOfFirstString:(NSString *)text1
- (NSUInteger)diff_commonOverlapOfFirstString:(NSString *)text1
andSecondString:(NSString *)text2;
{
- return (NSUInteger)diff_commonOverlap((CFStringRef)text1, (CFStringRef)text2);
+ return (NSUInteger)diff_commonOverlap(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2));
}
/**
@@ -444,7 +451,7 @@ - (NSUInteger)diff_commonOverlapOfFirstString:(NSString *)text1
- (NSArray *)diff_halfMatchOfFirstString:(NSString *)text1
andSecondString:(NSString *)text2;
{
- return [NSMakeCollectable(diff_halfMatchCreate((CFStringRef)text1, (CFStringRef)text2, Diff_Timeout)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSArray *, diff_halfMatchCreate(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2), Diff_Timeout));
}
/**
@@ -461,7 +468,7 @@ - (NSArray *)diff_halfMatchIOfLongString:(NSString *)longtext
andShortString:(NSString *)shorttext
index:(NSInteger)index;
{
- return [NSMakeCollectable(diff_halfMatchICreate((CFStringRef)longtext, (CFStringRef)shorttext, (CFIndex)index)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSArray *, diff_halfMatchICreate(JX_BRIDGED_CAST(CFStringRef, longtext), JX_BRIDGED_CAST(CFStringRef, shorttext), (CFIndex)index));
}
/**
@@ -515,7 +522,7 @@ - (NSMutableArray *)diff_computeFromOldString:(NSString *)text1
}
// Check to see if the problem can be split in two.
- NSArray *hm = [NSMakeCollectable(diff_halfMatchCreate((CFStringRef)text1, (CFStringRef)text2, Diff_Timeout)) autorelease];
+ NSArray *hm = JX_TRANSFER_CF_TO_OBJC(NSArray *, diff_halfMatchCreate(JX_BRIDGED_CAST(CFStringRef, text1), JX_BRIDGED_CAST(CFStringRef, text2), Diff_Timeout));
if (hm != nil) {
NSAutoreleasePool *splitPool = [NSAutoreleasePool new];
// A half-match was found, sort out the return data.
@@ -528,11 +535,11 @@ - (NSMutableArray *)diff_computeFromOldString:(NSString *)text1
NSMutableArray *diffs_a = [self diff_mainOfOldString:text1_a andNewString:text2_a checkLines:checklines deadline:deadline];
NSMutableArray *diffs_b = [self diff_mainOfOldString:text1_b andNewString:text2_b checkLines:checklines deadline:deadline];
// Merge the results.
- diffs = [diffs_a retain];
+ diffs = JX_RETAIN(diffs_a);
[diffs addObject:[Diff diffWithOperation:DIFF_EQUAL andText:mid_common]];
[diffs addObjectsFromArray:diffs_b];
[splitPool drain];
- return [diffs autorelease];
+ return JX_AUTORELEASE(diffs);
}
if (checklines && text1.length > 100 && text2.length > 100) {
@@ -541,10 +548,10 @@ - (NSMutableArray *)diff_computeFromOldString:(NSString *)text1
NSAutoreleasePool *bisectPool = [NSAutoreleasePool new];
diffs = [self diff_bisectOfOldString:text1 andNewString:text2 deadline:deadline];
- [diffs retain];
+ JX_RETAIN(diffs);
[bisectPool drain];
- return [diffs autorelease];
+ return JX_AUTORELEASE(diffs);
}
/**
@@ -568,10 +575,10 @@ - (NSMutableArray *)diff_lineModeFromOldString:(NSString *)text1
NSAutoreleasePool *recursePool = [NSAutoreleasePool new];
NSMutableArray *diffs = [self diff_mainOfOldString:text1 andNewString:text2 checkLines:NO deadline:deadline];
- [diffs retain];
+ JX_RETAIN(diffs);
[recursePool drain];
- [diffs autorelease];
+ JX_AUTORELEASE(diffs);
// Convert the diff back to original text.
[self diff_chars:diffs toLines:linearray];
@@ -636,9 +643,9 @@ - (NSString *)diff_linesToCharsMungeOfText:(NSString *)text
lineArray:(NSMutableArray *)lineArray
lineHash:(NSMutableDictionary *)lineHash;
{
- return [NSMakeCollectable(diff_linesToCharsMungeCFStringCreate((CFStringRef)text,
- (CFMutableArrayRef)lineArray,
- (CFMutableDictionaryRef)lineHash)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, diff_linesToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text),
+ JX_BRIDGED_CAST(CFMutableArrayRef, lineArray),
+ JX_BRIDGED_CAST(CFMutableDictionaryRef, lineHash)));
}
/**
@@ -653,9 +660,9 @@ - (NSString *)diff_wordsToCharsMungeOfText:(NSString *)text
wordArray:(NSMutableArray *)wordArray
wordHash:(NSMutableDictionary *)wordHash;
{
- return [NSMakeCollectable(diff_wordsToCharsMungeCFStringCreate((CFStringRef)text,
- (CFMutableArrayRef)wordArray,
- (CFMutableDictionaryRef)wordHash)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, diff_wordsToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text),
+ JX_BRIDGED_CAST(CFMutableArrayRef, wordArray),
+ JX_BRIDGED_CAST(CFMutableDictionaryRef, wordHash)));
}
/**
@@ -670,9 +677,9 @@ - (NSString *)diff_sentencesToCharsMungeOfText:(NSString *)text
sentenceArray:(NSMutableArray *)sentenceArray
sentenceHash:(NSMutableDictionary *)sentenceHash;
{
- return [NSMakeCollectable(diff_sentencesToCharsMungeCFStringCreate((CFStringRef)text,
- (CFMutableArrayRef)sentenceArray,
- (CFMutableDictionaryRef)sentenceHash)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, diff_sentencesToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text),
+ JX_BRIDGED_CAST(CFMutableArrayRef, sentenceArray),
+ JX_BRIDGED_CAST(CFMutableDictionaryRef, sentenceHash)));
}
/**
@@ -687,9 +694,9 @@ - (NSString *)diff_paragraphsToCharsMungeOfText:(NSString *)text
paragraphArray:(NSMutableArray *)paragraphArray
paragraphHash:(NSMutableDictionary *)paragraphHash;
{
- return [NSMakeCollectable(diff_paragraphsToCharsMungeCFStringCreate((CFStringRef)text,
- (CFMutableArrayRef)paragraphArray,
- (CFMutableDictionaryRef)paragraphHash)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, diff_paragraphsToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text),
+ JX_BRIDGED_CAST(CFMutableArrayRef, paragraphArray),
+ JX_BRIDGED_CAST(CFMutableDictionaryRef, paragraphHash)));
}
/**
@@ -706,9 +713,9 @@ - (NSString *)diff_lineBreakDelimiteredToCharsMungeOfText:(NSString *)text
lineArray:(NSMutableArray *)lineArray
lineHash:(NSMutableDictionary *)lineHash;
{
- return [NSMakeCollectable(diff_lineBreakDelimiteredToCharsMungeCFStringCreate((CFStringRef)text,
- (CFMutableArrayRef)lineArray,
- (CFMutableDictionaryRef)lineHash)) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, diff_lineBreakDelimiteredToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text),
+ JX_BRIDGED_CAST(CFMutableArrayRef, lineArray),
+ JX_BRIDGED_CAST(CFMutableDictionaryRef, lineHash)));
}
/**
@@ -733,8 +740,8 @@ - (NSMutableArray *)diff_bisectOfOldString:(NSString *)_text1
BOOL validDeadline = (deadline != [[NSDate distantFuture] timeIntervalSinceReferenceDate]);
- CFStringRef text1 = (CFStringRef)_text1;
- CFStringRef text2 = (CFStringRef)_text2;
+ CFStringRef text1 = JX_BRIDGED_CAST(CFStringRef, _text1);
+ CFStringRef text2 = JX_BRIDGED_CAST(CFStringRef, _text2);
// Cache the text lengths to prevent multiple calls.
CFIndex text1_length = CFStringGetLength(text1);
@@ -934,18 +941,15 @@ - (NSArray *)diff_linesToCharsForFirstString:(NSString *)text1
// So we'll insert a junk entry to avoid generating a nil character.
[lineArray addObject:@""];
- NSString *chars1 = NSMakeCollectable(diff_linesToCharsMungeCFStringCreate((CFStringRef)text1,
- (CFMutableArrayRef)lineArray,
- lineHash));
- NSString *chars2 = NSMakeCollectable(diff_linesToCharsMungeCFStringCreate((CFStringRef)text2,
- (CFMutableArrayRef)lineArray,
- lineHash));
+ NSString *chars1 = JX_TRANSFER_CF_TO_OBJC(NSString *, diff_linesToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text1),
+ JX_BRIDGED_CAST(CFMutableArrayRef, lineArray),
+ lineHash));
+ NSString *chars2 = JX_TRANSFER_CF_TO_OBJC(NSString *, diff_linesToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text2),
+ JX_BRIDGED_CAST(CFMutableArrayRef, lineArray),
+ lineHash));
NSArray *result = [NSArray arrayWithObjects:chars1, chars2, lineArray, nil];
- [chars1 release];
- [chars2 release];
-
CFRelease(lineHash);
return result;
@@ -999,20 +1003,17 @@ - (NSArray *)diff_tokensToCharsForFirstString:(NSString *)text1
// So we'll insert a junk entry to avoid generating a nil character.
[tokenArray addObject:@""];
- NSString *tokens1 = NSMakeCollectable(diff_tokensToCharsMungeCFStringCreate((CFStringRef)text1,
- (CFMutableArrayRef)tokenArray,
- tokenHash,
- tokenizerOptions));
- NSString *tokens2 = NSMakeCollectable(diff_tokensToCharsMungeCFStringCreate((CFStringRef)text2,
- (CFMutableArrayRef)tokenArray,
- tokenHash,
- tokenizerOptions));
+ NSString *tokens1 = JX_TRANSFER_CF_TO_OBJC(NSString *, diff_tokensToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text1),
+ JX_BRIDGED_CAST(CFMutableArrayRef, tokenArray),
+ tokenHash,
+ tokenizerOptions));
+ NSString *tokens2 = JX_TRANSFER_CF_TO_OBJC(NSString *, diff_tokensToCharsMungeCFStringCreate(JX_BRIDGED_CAST(CFStringRef, text2),
+ JX_BRIDGED_CAST(CFMutableArrayRef, tokenArray),
+ tokenHash,
+ tokenizerOptions));
NSArray *result = [NSArray arrayWithObjects:tokens1, tokens2, tokenArray, nil];
- [tokens1 release];
- [tokens2 release];
-
CFRelease(tokenHash);
return result;
@@ -1043,9 +1044,9 @@ - (NSArray *)diff_wordsToCharsForFirstString:(NSString *)text1
*/
NS_INLINE NSString * diff_charsToTokenString(NSString *charsString, NSArray *tokenArray)
{
- CFStringRef text = diff_charsToTokenCFStringCreate((CFStringRef)charsString, (CFArrayRef)tokenArray);
+ CFStringRef text = diff_charsToTokenCFStringCreate(JX_BRIDGED_CAST(CFStringRef, charsString), JX_BRIDGED_CAST(CFArrayRef, tokenArray));
- return [NSMakeCollectable(text) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, text);
}
/**
@@ -1122,7 +1123,7 @@ - (void)diff_cleanupMerge:(NSMutableArray *)diffs;
if (count_delete + count_insert > 1) {
if (count_delete != 0 && count_insert != 0) {
// Factor out any common prefixes.
- commonlength = (NSUInteger)diff_commonPrefix((CFStringRef)text_insert, (CFStringRef)text_delete);
+ commonlength = (NSUInteger)diff_commonPrefix(JX_BRIDGED_CAST(CFStringRef, text_insert), JX_BRIDGED_CAST(CFStringRef, text_delete));
if (commonlength != 0) {
if ((thisPointer - count_delete - count_insert) > 0 &&
((Diff *)[diffs objectAtIndex:(thisPointer - count_delete - count_insert - 1)]).operation
@@ -1140,7 +1141,7 @@ - (void)diff_cleanupMerge:(NSMutableArray *)diffs;
text_delete = [text_delete substringFromIndex:commonlength];
}
// Factor out any common suffixes.
- commonlength = (NSUInteger)diff_commonSuffix((CFStringRef)text_insert, (CFStringRef)text_delete);
+ commonlength = (NSUInteger)diff_commonSuffix(JX_BRIDGED_CAST(CFStringRef, text_insert), JX_BRIDGED_CAST(CFStringRef, text_delete));
if (commonlength != 0) {
thisDiff.text = [[text_insert substringFromIndex:(text_insert.length
- commonlength)] stringByAppendingString:thisDiff.text];
@@ -1249,7 +1250,7 @@ - (void)diff_cleanupSemanticLossless:(NSMutableArray *)diffs;
NSString *equality2 = nextDiff.text;
// First, shift the edit as far left as possible.
- NSUInteger commonOffset = (NSUInteger)diff_commonSuffix((CFStringRef)equality1, (CFStringRef)edit);
+ NSUInteger commonOffset = (NSUInteger)diff_commonSuffix(JX_BRIDGED_CAST(CFStringRef, equality1), JX_BRIDGED_CAST(CFStringRef, edit));
if (commonOffset > 0) {
NSString *commonString = [edit substringFromIndex:(edit.length - commonOffset)];
@@ -1263,15 +1264,15 @@ - (void)diff_cleanupSemanticLossless:(NSMutableArray *)diffs;
NSString *bestEquality1 = equality1;
NSString *bestEdit = edit;
NSString *bestEquality2 = equality2;
- CFIndex bestScore = diff_cleanupSemanticScore((CFStringRef)equality1, (CFStringRef)edit) +
- diff_cleanupSemanticScore((CFStringRef)edit, (CFStringRef)equality2);
+ CFIndex bestScore = diff_cleanupSemanticScore(JX_BRIDGED_CAST(CFStringRef, equality1), JX_BRIDGED_CAST(CFStringRef, edit)) +
+ diff_cleanupSemanticScore(JX_BRIDGED_CAST(CFStringRef, edit), JX_BRIDGED_CAST(CFStringRef, equality2));
while (edit.length != 0 && equality2.length != 0
&& [edit characterAtIndex:0] == [equality2 characterAtIndex:0]) {
equality1 = [equality1 stringByAppendingString:[edit substringToIndex:1]];
edit = [[edit substringFromIndex:1] stringByAppendingString:[equality2 substringToIndex:1]];
equality2 = [equality2 substringFromIndex:1];
- CFIndex score = diff_cleanupSemanticScore((CFStringRef)equality1, (CFStringRef)edit) +
- diff_cleanupSemanticScore((CFStringRef)edit, (CFStringRef)equality2);
+ CFIndex score = diff_cleanupSemanticScore(JX_BRIDGED_CAST(CFStringRef, equality1), JX_BRIDGED_CAST(CFStringRef, edit)) +
+ diff_cleanupSemanticScore(JX_BRIDGED_CAST(CFStringRef, edit), JX_BRIDGED_CAST(CFStringRef, equality2));
// The >= encourages trailing rather than leading whitespace on edits.
if (score >= bestScore) {
bestScore = score;
@@ -1317,7 +1318,7 @@ - (void)diff_cleanupSemanticLossless:(NSMutableArray *)diffs;
- (NSInteger)diff_cleanupSemanticScoreOfFirstString:(NSString *)one
andSecondString:(NSString *)two;
{
- return diff_cleanupSemanticScore((CFStringRef)one, (CFStringRef)two);
+ return diff_cleanupSemanticScore(JX_BRIDGED_CAST(CFStringRef, one), JX_BRIDGED_CAST(CFStringRef, two));
}
/**
@@ -1432,7 +1433,7 @@ - (NSString *)diff_prettyHtml:(NSMutableArray *)diffs;
{
NSMutableString *html = [NSMutableString string];
for (Diff *aDiff in diffs) {
- NSMutableString *text = [[aDiff.text mutableCopy] autorelease];
+ NSMutableString *text = JX_AUTORELEASE([aDiff.text mutableCopy]);
[text replaceOccurrencesOfString:@"&" withString:@"&" options:NSLiteralSearch range:NSMakeRange(0, text.length)];
[text replaceOccurrencesOfString:@"<" withString:@"&lt;" options:NSLiteralSearch range:NSMakeRange(0, text.length)];
[text replaceOccurrencesOfString:@">" withString:@"&gt;" options:NSLiteralSearch range:NSMakeRange(0, text.length)];
@@ -1546,6 +1547,7 @@ - (NSMutableArray *)diff_fromDeltaWithText:(NSString *)text1
NSString *param = [token substringFromIndex:1];
switch ([token characterAtIndex:0]) {
case '+':
+ {
param = [param diff_stringByReplacingPercentEscapesForEncodeUriCompatibility];
if (param == nil) {
if (error != NULL) {
@@ -1558,9 +1560,11 @@ - (NSMutableArray *)diff_fromDeltaWithText:(NSString *)text1
}
[diffs addObject:[Diff diffWithOperation:DIFF_INSERT andText:param]];
break;
+ }
case '-':
// Fall through.
case '=':
+ {
n = [param integerValue];
if (n == 0) {
if (error != NULL) {
@@ -1601,7 +1605,9 @@ - (NSMutableArray *)diff_fromDeltaWithText:(NSString *)text1
[diffs addObject:[Diff diffWithOperation:DIFF_DELETE andText:text]];
}
break;
+ }
default:
+ {
// Anything else is an error.
if (error != NULL) {
errorDetail = [NSDictionary dictionaryWithObjectsAndKeys:
@@ -1611,6 +1617,7 @@ - (NSMutableArray *)diff_fromDeltaWithText:(NSString *)text1
*error = [NSError errorWithDomain:@"DiffMatchPatchErrorDomain" code:102 userInfo:errorDetail];
}
return nil;
+ }
}
}
if (thisPointer != text1.length) {
@@ -1801,8 +1808,8 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
if (prevDiff.operation == DIFF_DELETE && thisDiff.operation == DIFF_INSERT) {
NSString *deletion = prevDiff.text;
NSString *insertion = thisDiff.text;
- NSUInteger overlap_length1 = (NSUInteger)diff_commonOverlap((CFStringRef)deletion, (CFStringRef)insertion);
- NSUInteger overlap_length2 = (NSUInteger)diff_commonOverlap((CFStringRef)insertion, (CFStringRef)deletion);
+ NSUInteger overlap_length1 = (NSUInteger)diff_commonOverlap(JX_BRIDGED_CAST(CFStringRef, deletion), JX_BRIDGED_CAST(CFStringRef, insertion));
+ NSUInteger overlap_length2 = (NSUInteger)diff_commonOverlap(JX_BRIDGED_CAST(CFStringRef, insertion), JX_BRIDGED_CAST(CFStringRef, deletion));
if (overlap_length1 >= overlap_length2) {
if (overlap_length1 >= deletion.length / 2.0f ||
overlap_length1 >= insertion.length / 2.0f) {
@@ -1811,10 +1818,12 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
[diffs insertObject:[Diff diffWithOperation:DIFF_EQUAL
andText:[insertion substringToIndex:overlap_length1]]
atIndex:thisPointer];
- [insertion retain];
+#if (JX_HAS_ARC == 0)
+ JX_RETAIN(insertion);
+#endif
prevDiff.text = [deletion substringToIndex:(deletion.length - overlap_length1)];
nextDiff.text = [insertion substringFromIndex:overlap_length1];
- [insertion release];
+ JX_RELEASE(insertion);
thisPointer++;
}
} else {
@@ -1825,12 +1834,14 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
[diffs insertObject:[Diff diffWithOperation:DIFF_EQUAL
andText:[deletion substringToIndex:overlap_length2]]
atIndex:thisPointer];
- [deletion retain];
+#if (JX_HAS_ARC == 0)
+ JX_RETAIN(deletion);
+#endif
prevDiff.operation = DIFF_INSERT;
prevDiff.text = [insertion substringToIndex:(insertion.length - overlap_length2)];
nextDiff.operation = DIFF_DELETE;
nextDiff.text = [deletion substringFromIndex:overlap_length2];
- [deletion release];
+ JX_RELEASE(deletion);
thisPointer++;
}
}
@@ -2049,7 +2060,7 @@ - (double)match_bitapScoreForErrorCount:(NSUInteger)e
- (NSMutableDictionary *)match_alphabet:(NSString *)pattern;
{
NSMutableDictionary *s = [NSMutableDictionary dictionary];
- CFStringRef str = (CFStringRef)pattern;
+ CFStringRef str = JX_BRIDGED_CAST(CFStringRef, pattern);
CFStringInlineBuffer inlineBuffer;
CFIndex length;
CFIndex cnt;
@@ -2062,8 +2073,8 @@ - (NSMutableDictionary *)match_alphabet:(NSString *)pattern;
for (cnt = 0; cnt < length; cnt++) {
ch = CFStringGetCharacterFromInlineBuffer(&inlineBuffer, cnt);
c = diff_CFStringCreateFromUnichar(ch);
- if (![s diff_containsObjectForKey:(NSString *)c]) {
- [s diff_setUnsignedIntegerValue:0 forKey:(NSString *)c];
+ if (![s diff_containsObjectForKey:JX_BRIDGED_CAST(NSString *, c)]) {
+ [s diff_setUnsignedIntegerValue:0 forKey:JX_BRIDGED_CAST(NSString *, c)];
}
CFRelease(c);
}
@@ -2072,8 +2083,8 @@ - (NSMutableDictionary *)match_alphabet:(NSString *)pattern;
for (cnt = 0; cnt < length; cnt++) {
ch = CFStringGetCharacterFromInlineBuffer(&inlineBuffer, cnt);
c = diff_CFStringCreateFromUnichar(ch);
- NSUInteger value = [s diff_unsignedIntegerForKey:(NSString *)c] | (1 << (pattern.length - i - 1));
- [s diff_setUnsignedIntegerValue:value forKey:(NSString *)c];
+ NSUInteger value = [s diff_unsignedIntegerForKey:JX_BRIDGED_CAST(NSString *, c)] | (1 << (pattern.length - i - 1));
+ [s diff_setUnsignedIntegerValue:value forKey:JX_BRIDGED_CAST(NSString *, c)];
i++;
CFRelease(c);
}
@@ -2215,13 +2226,13 @@ - (NSMutableArray *)patch_makeFromOldString:(NSString *)text1
if (diffs.count == 0) {
return patches; // Get rid of the nil case.
}
- Patch *patch = [[Patch new] autorelease];
+ Patch *patch = JX_AUTORELEASE([Patch new]);
NSUInteger char_count1 = 0; // Number of characters into the text1 NSString.
NSUInteger char_count2 = 0; // Number of characters into the text2 NSString.
// Start with text1 (prepatch_text) and apply the diffs until we arrive at
// text2 (postpatch_text). We recreate the patches one by one to determine
// context info.
- NSString *prepatch_text = [text1 retain];
+ NSString *prepatch_text = JX_RETAIN(text1);
NSMutableString *postpatch_text = [text1 mutableCopy];
for (Diff *aDiff in diffs) {
if (patch.diffs.count == 0 && aDiff.operation != DIFF_EQUAL) {
@@ -2255,12 +2266,12 @@ - (NSMutableArray *)patch_makeFromOldString:(NSString *)text1
if (patch.diffs.count != 0) {
[self patch_addContextToPatch:patch sourceText:prepatch_text];
[patches addObject:patch];
- patch = [[Patch new] autorelease];
+ patch = JX_AUTORELEASE([Patch new]);
// Unlike Unidiff, our patch lists have a rolling context.
// http://code.google.com/p/google-diff-match-patch/wiki/Unidiff
// Update prepatch text & pos to reflect the application of the
// just completed patch.
- [prepatch_text release];
+ JX_RELEASE(prepatch_text);
prepatch_text = [postpatch_text copy];
char_count1 = char_count2;
}
@@ -2282,8 +2293,8 @@ - (NSMutableArray *)patch_makeFromOldString:(NSString *)text1
[patches addObject:patch];
}
- [prepatch_text release];
- [postpatch_text release];
+ JX_RELEASE(prepatch_text);
+ JX_RELEASE(postpatch_text);
return patches;
}
@@ -2315,9 +2326,9 @@ - (NSArray *)patch_apply:(NSArray *)sourcePatches
}
// Deep copy the patches so that no changes are made to originals.
- NSMutableArray *patches = [[self patch_deepCopy:sourcePatches] autorelease];
+ NSMutableArray *patches = JX_AUTORELEASE([self patch_deepCopy:sourcePatches]);
- NSMutableString *textMutable = [[text mutableCopy] autorelease];
+ NSMutableString *textMutable = JX_AUTORELEASE([text mutableCopy]);
NSString *nullPadding = [self patch_addPadding:patches];
[textMutable insertString:nullPadding atIndex:0];
@@ -2435,7 +2446,7 @@ - (NSString *)patch_addPadding:(NSMutableArray *)patches;
uint16_t paddingLength = Patch_Margin;
NSMutableString *nullPadding = [NSMutableString string];
for (UniChar x = 1; x <= paddingLength; x++) {
- CFStringAppendCharacters((CFMutableStringRef)nullPadding, &x, 1);
+ CFStringAppendCharacters(JX_BRIDGED_CAST(CFMutableStringRef, nullPadding), &x, 1);
}
// Bump all the patches forward.
@@ -2499,15 +2510,15 @@ - (void)patch_splitMax:(NSMutableArray *)patches;
if (((Patch *)[patches objectAtIndex:x]).length1 <= patch_size) {
continue;
}
- Patch *bigpatch = [[patches objectAtIndex:x] retain];
+ Patch *bigpatch = JX_RETAIN([patches objectAtIndex:x]);
// Remove the big old patch.
splice(patches, x--, 1, nil);
NSUInteger start1 = bigpatch.start1;
NSUInteger start2 = bigpatch.start2;
NSString *precontext = @"";
while (bigpatch.diffs.count != 0) {
// Create one of several smaller patches.
- Patch *patch = [[Patch new] autorelease];
+ Patch *patch = JX_AUTORELEASE([Patch new]);
BOOL empty = YES;
patch.start1 = start1 - precontext.length;
patch.start2 = start2 - precontext.length;
@@ -2587,7 +2598,7 @@ - (void)patch_splitMax:(NSMutableArray *)patches;
}
}
- [bigpatch release];
+ JX_RELEASE(bigpatch);
}
}
@@ -2638,7 +2649,7 @@ - (NSMutableArray *)patch_fromText:(NSString *)textline
while (textPointer < text.count) {
NSString *thisLine = [text objectAtIndex:textPointer];
NSScanner *theScanner = [NSScanner scannerWithString:thisLine];
- patch = [[Patch new] autorelease];
+ patch = JX_AUTORELEASE([Patch new]);
scanSuccess = ([theScanner scanString:patchHeaderStart intoString:NULL]
&& [theScanner scanInteger:&scannedValue]);
View
5 NSString+JavaSubstring.m
@@ -23,13 +23,14 @@
#import "NSString+JavaSubstring.h"
#import "DiffMatchPatchCFUtilities.h"
+#import "JXArcCompatibilityMacros.h"
@implementation NSString (JavaSubstring)
- (NSString *)diff_javaSubstringFromStart:(NSUInteger)start toEnd:(NSUInteger)end;
{
- CFStringRef c = diff_CFStringCreateJavaSubstring((CFStringRef)self, (CFIndex)start, (CFIndex)end);
- return [NSMakeCollectable(c) autorelease];
+ CFStringRef c = diff_CFStringCreateJavaSubstring(JX_BRIDGED_CAST(CFStringRef, self), (CFIndex)start, (CFIndex)end);
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, c);
}
@end
View
3 NSString+UnicharUtilities.m
@@ -21,14 +21,15 @@
*/
#import "NSString+UnicharUtilities.h"
+#import "JXArcCompatibilityMacros.h"
@implementation NSString (UnicharUtilities)
+ (NSString *)diff_stringFromUnichar:(unichar)ch;
{
CFStringRef c = CFStringCreateWithCharacters(kCFAllocatorDefault, &ch, 1);
- return [NSMakeCollectable(c) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, c);
}
- (NSString *)diff_substringWithCharacterAtIndex:(NSUInteger)anIndex;
View
9 NSString+UriCompatibility.m
@@ -21,6 +21,7 @@
*/
#import "NSString+UriCompatibility.h"
+#import "JXArcCompatibilityMacros.h"
@implementation NSString (UriCompatibility)
@@ -35,11 +36,11 @@ @implementation NSString (UriCompatibility)
- (NSString *)diff_stringByAddingPercentEscapesForEncodeUriCompatibility;
{
CFStringRef urlString = CFURLCreateStringByAddingPercentEscapes(NULL,
- (CFStringRef)self,
+ JX_BRIDGED_CAST(CFStringRef, self),
CFSTR(" !~*'();/?:@&=+$,#"),
NULL,
kCFStringEncodingUTF8);
- return [NSMakeCollectable(urlString) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, urlString);
}
/**
@@ -52,10 +53,10 @@ - (NSString *)diff_stringByAddingPercentEscapesForEncodeUriCompatibility;
- (NSString *)diff_stringByReplacingPercentEscapesForEncodeUriCompatibility;
{
CFStringRef decodedString = CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL,
- (CFStringRef)self,
+ JX_BRIDGED_CAST(CFStringRef, self),
CFSTR(""),
kCFStringEncodingUTF8);
- return [NSMakeCollectable(decodedString) autorelease];
+ return JX_TRANSFER_CF_TO_OBJC(NSString *, decodedString);
}
@end
View
59 Tests/DiffMatchPatchTest.m
@@ -24,6 +24,7 @@
#import "DiffMatchPatch.h"
#import "NSMutableDictionary+DMPExtensions.h"
+#import "JXArcCompatibilityMacros.h"
#define stringForBOOL(A) ([((NSNumber *)A) boolValue] ? @"true" : @"false")
@@ -46,7 +47,7 @@ - (void)test_diff_commonPrefixTest {
// Whole case.
STAssertEquals((NSUInteger)4, [dmp diff_commonPrefixOfFirstString:@"1234" andSecondString:@"1234xyz"], @"Common suffix whole case failed.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_commonSuffixTest {
@@ -62,7 +63,7 @@ - (void)test_diff_commonSuffixTest {
// Whole case.
STAssertEquals((NSUInteger)4, [dmp diff_commonSuffixOfFirstString:@"1234" andSecondString:@"xyz1234"], @"Detect any common suffix. Whole case.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_commonOverlapTest {
@@ -86,7 +87,7 @@ - (void)test_diff_commonOverlapTest {
// component letters. E.g. U+FB01 == 'fi'
STAssertEquals((NSUInteger)0, [dmp diff_commonOverlapOfFirstString:@"fi" andSecondString:@"\U0000fb01i"], @"Detect any suffix/prefix overlap. Unicode.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_halfmatchTest {
@@ -131,7 +132,7 @@ - (void)test_diff_halfmatchTest {
dmp.Diff_Timeout = 0;
STAssertNil([dmp diff_halfMatchOfFirstString:@"qHilloHelloHew" andSecondString:@"xHelloHeHulloy"], @"Optimal no halfmatch.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_linesToCharsTest {
@@ -187,7 +188,7 @@ - (void)test_diff_linesToCharsTest {
STAssertEqualObjects(@"", [result objectAtIndex:1], @"More than 256 #4.");
STAssertEqualObjects(tmpVector, (NSArray *)[result objectAtIndex:2], @"More than 256 #5.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_wordsToCharsTest {
@@ -255,7 +256,7 @@ - (void)test_diff_wordsToCharsTest {
STAssertEqualObjects(@"", [result objectAtIndex:1], @"Convert words down to characters #13");
STAssertEqualObjects(tmpVector, (NSArray *)[result objectAtIndex:2], @"Convert words down to characters #14");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_charsToLinesTest {
@@ -294,7 +295,7 @@ - (void)test_diff_charsToLinesTest {
[dmp diff_chars:diffs toLines:tmpVector];
STAssertEqualObjects([NSArray arrayWithObject:[Diff diffWithOperation:DIFF_DELETE andText:lines]], diffs, @"More than 256 #3.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_cleanupMergeTest {
@@ -373,7 +374,7 @@ - (void)test_diff_cleanupMergeTest {
expectedResult = [NSMutableArray arrayWithObjects:[Diff diffWithOperation:DIFF_EQUAL andText:@"xca"], [Diff diffWithOperation:DIFF_DELETE andText:@"cba"], nil];
STAssertEqualObjects(expectedResult, diffs, @"Slide edit right recursive.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_cleanupSemanticLosslessTest {
@@ -468,7 +469,7 @@ - (void)test_diff_cleanupSemanticLosslessTest {
[Diff diffWithOperation:DIFF_EQUAL andText:@" The yyy."], nil];
STAssertEqualObjects(expectedResult, diffs, @"Sentence boundaries.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_cleanupSemanticTest {
@@ -612,7 +613,7 @@ - (void)test_diff_cleanupSemanticTest {
[Diff diffWithOperation:DIFF_INSERT andText:@"BC"], nil];
STAssertEqualObjects(expectedResult, diffs, @"Two overlap eliminations.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_cleanupEfficiencyTest {
@@ -697,7 +698,7 @@ - (void)test_diff_cleanupEfficiencyTest {
STAssertEqualObjects(expectedResult, diffs, @"High cost elimination.");
dmp.Diff_EditCost = 4;
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_prettyHtmlTest {
@@ -711,7 +712,7 @@ - (void)test_diff_prettyHtmlTest {
NSString *expectedResult = @"<span>a&para;<br></span><del style=\"background:#ffe6e6;\">&lt;B&gt;b&lt;/B&gt;</del><ins style=\"background:#e6ffe6;\">c&amp;d</ins>";
STAssertEqualObjects(expectedResult, [dmp diff_prettyHtml:diffs], @"Pretty print.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_textTest {
@@ -730,7 +731,7 @@ - (void)test_diff_textTest {
STAssertEqualObjects(@"jumped over a lazy", [dmp diff_text2:diffs], @"Compute the source and destination texts #2");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_deltaTest {
@@ -809,7 +810,7 @@ - (void)test_diff_deltaTest {
expectedResult = [dmp diff_fromDeltaWithText:@"" andDelta:delta error:NULL];
STAssertEqualObjects(diffs, expectedResult, @"diff_fromDelta: Unchanged characters. Convert delta string into a diff.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_xIndexTest {
@@ -828,7 +829,7 @@ - (void)test_diff_xIndexTest {
[Diff diffWithOperation:DIFF_EQUAL andText:@"xyz"], nil] /* Diff */;
STAssertEquals((NSUInteger)1, [dmp diff_xIndexIn:diffs location:3], @"diff_xIndex: Translation on deletion.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_levenshteinTest {
@@ -852,7 +853,7 @@ - (void)test_diff_levenshteinTest {
[Diff diffWithOperation:DIFF_INSERT andText:@"1234"], nil] /* Diff */;
STAssertEquals((NSUInteger)7, [dmp diff_levenshtein:diffs], @"diff_levenshtein: Levenshtein with middle equality.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)diff_bisectTest;
@@ -872,7 +873,7 @@ - (void)diff_bisectTest;
diffs = [NSMutableArray arrayWithObjects:[Diff diffWithOperation:DIFF_DELETE andText:@"cat"], [Diff diffWithOperation:DIFF_INSERT andText:@"map"], nil];
STAssertEqualObjects(diffs, [dmp diff_bisectOfOldString:a andNewString:b deadline:[[NSDate distantPast] timeIntervalSinceReferenceDate]], @"Bisect timeout.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_diff_mainTest {
@@ -964,7 +965,7 @@ - (void)test_diff_mainTest {
// CHANGEME: Test null inputs
- [dmp release];
+ JX_RELEASE(dmp);
}
@@ -989,7 +990,7 @@ - (void)test_match_alphabetTest {
[bitmask diff_setUnsignedIntegerValue:8 forUnicharKey:'c'];
STAssertEqualObjects(bitmask, [dmp match_alphabet:@"abcaba"], @"match_alphabet: Duplicates.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_match_bitapTest {
@@ -1038,7 +1039,7 @@ - (void)test_match_bitapTest {
dmp.Match_Distance = 1000; // Loose location.
STAssertEquals((NSUInteger)0, [dmp match_bitapOfText:@"abcdefghijklmnopqrstuvwxyz" andPattern:@"abcdefg" near:24], @"match_bitap: Distance test #3.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_match_mainTest {
@@ -1063,7 +1064,7 @@ - (void)test_match_mainTest {
// CHANGEME: Test null inputs
- [dmp release];
+ JX_RELEASE(dmp);
}
@@ -1073,7 +1074,7 @@ - (void)test_match_mainTest {
- (void)test_patch_patchObjTest {
// Patch Object.
- Patch *p = [[Patch new] autorelease];
+ Patch *p = JX_AUTORELEASE([Patch new]);
p.start1 = 20;
p.start2 = 21;
p.length1 = 18;
@@ -1113,7 +1114,7 @@ - (void)test_patch_fromTextTest {
}
error = nil;
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_patch_toTextTest {
@@ -1128,7 +1129,7 @@ - (void)test_patch_toTextTest {
patches = [dmp patch_fromText:strp error:NULL];
STAssertEqualObjects(strp, [dmp patch_toText:patches], @"toText Test #2");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_patch_addContextTest {
@@ -1152,7 +1153,7 @@ - (void)test_patch_addContextTest {
[dmp patch_addContextToPatch:p sourceText:@"The quick brown fox jumps. The quick brown fox crashes."];
STAssertEqualObjects(@"@@ -1,27 +1,28 @@\n Th\n-e\n+at\n quick brown fox jumps. \n", [p description], @"patch_addContext: Ambiguity.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_patch_makeTest {
@@ -1209,7 +1210,7 @@ - (void)test_patch_makeTest {
// CHANGEME: Test null inputs
- [dmp release];
+ JX_RELEASE(dmp);
}
@@ -1235,7 +1236,7 @@ - (void)test_patch_splitMaxTest {
[dmp patch_splitMax:patches];
STAssertEqualObjects(@"@@ -2,32 +2,32 @@\n bcdefghij , h : \n-0\n+1\n , t : 1 abcdef\n@@ -29,32 +29,32 @@\n bcdefghij , h : \n-0\n+1\n , t : 1 abcdef\n", [dmp patch_toText:patches], @"Assumes that Match_MaxBits is 32 #4");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_patch_addPaddingTest {
@@ -1269,7 +1270,7 @@ - (void)test_patch_addPaddingTest {
[dmp patch_toText:patches],
@"patch_addPadding: Both edges none.");
- [dmp release];
+ JX_RELEASE(dmp);
}
- (void)test_patch_applyTest {
@@ -1359,7 +1360,7 @@ - (void)test_patch_applyTest {
resultStr = [NSString stringWithFormat:@"%@\t%@", [results objectAtIndex:0], stringForBOOL([boolArray objectAtIndex:0])];
STAssertEqualObjects(@"x123\ttrue", resultStr, @"patch_apply: Edge partial match.");
- [dmp release];
+ JX_RELEASE(dmp);
}
View
5 Tests/TestUtilities.m
@@ -20,6 +20,7 @@
*/
#import "TestUtilities.h"
+#import "JXArcCompatibilityMacros.h"
NSString * diff_stringForFilePath(NSString *aFilePath) {
NSString *absoluteFilePath;
@@ -58,9 +59,9 @@
// For performance reasons, NSAttributedString’s -string method returns the current backing store of the attributed string object.
// We need to make a copy or we will get a zombie soon after releasing attributedString below.
- NSString *string = [[[attributedString string] copy] autorelease];
+ NSString *string = JX_AUTORELEASE([[attributedString string] copy]);
- [attributedString release];
+ JX_RELEASE(attributedString);
return string;
}
View
7 Tests/mode-test.m
@@ -24,6 +24,7 @@
#import <DiffMatchPatch/DiffMatchPatch.h>
#import "TestUtilities.h"
+#import "JXArcCompatibilityMacros.h"
typedef enum {
@@ -93,13 +94,13 @@
[dmp diff_chars:diffs toLines:tokenArray];
}
- [dmp release];
+ JX_RELEASE(dmp);
return diffs;
}
NSMutableArray * diff_defaultMode(NSString *text1, NSString *text2) {
- DiffMatchPatch *dmp = [[DiffMatchPatch new] autorelease];
+ DiffMatchPatch *dmp = JX_AUTORELEASE([DiffMatchPatch new]);
dmp.Diff_Timeout = 0;
NSMutableArray *diffs = [dmp diff_mainOfOldString:text1 andNewString:text2 checkLines:NO];
@@ -116,7 +117,7 @@ int main (int argc, const char * argv[]) {
if ([cliArguments count] < 3) {
fprintf(stderr, "usage: %s <txt1> <txt2> [default|line|word|paragraph|sentence|line-break-delimitered]\n",
[[[NSProcessInfo processInfo] processName] UTF8String]);
- [pool drain];
+ JX_DRAIN_AUTORELEASE_POOL_WITH_NAME(pool);
return EXIT_FAILURE;
}
View
3 Tests/speedtest.m
@@ -24,6 +24,7 @@
#import <DiffMatchPatch/DiffMatchPatch.h>
#import "TestUtilities.h"
+#import "JXArcCompatibilityMacros.h"
void diff_measureTimeForDiff(DiffMatchPatch *dmp, NSString *text1, NSString *text2, NSString *aDescription);
@@ -70,7 +71,7 @@ int main (int argc, const char * argv[]) {
aDescription = [NSString stringWithFormat:@"%8lu unichars, ", (unsigned long)MAX(text1.length, text2.length)];
diff_measureTimeForDiff(dmp, text1, text2, aDescription);
- [dmp release];
+ JX_RELEASE(dmp);
[pool drain];
return 0;

0 comments on commit fda8aa4

Please sign in to comment.