Skip to content

Commit ad1e9fd

Browse files
author
Neil Fraser
committed
Rename a couple of variables.
1 parent 4df5bbc commit ad1e9fd

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

objectivec/DiffMatchPatch.m

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ - (void)diff_chars:(NSArray *)diffs toLines:(NSMutableArray *)lineArray;
872872
NSUInteger lineHash;
873873
for (Diff *diff in diffs) {
874874
text = [NSMutableString string];
875-
for (NSUInteger y = 0; y < [diff.text length]; y++) {
876-
lineHash = (NSUInteger)[diff.text characterAtIndex:y];
875+
for (NSUInteger j = 0; j < [diff.text length]; j++) {
876+
lineHash = (NSUInteger)[diff.text characterAtIndex:j];
877877
[text appendString:[lineArray objectAtIndex:lineHash]];
878878
}
879879
diff.text = text;
@@ -1137,7 +1137,7 @@ - (void)diff_cleanupEfficiency:(NSMutableArray *)diffs;
11371137
// Stack of indices where equalities are found.
11381138
NSMutableArray *equalities = [NSMutableArray array];
11391139
// Always equal to equalities.lastObject.text
1140-
NSString *lastequality = nil;
1140+
NSString *lastEquality = nil;
11411141
NSInteger thisPointer = 0; // Index of current position.
11421142
// Is there an insertion operation before the last equality.
11431143
BOOL pre_ins = NO;
@@ -1158,11 +1158,11 @@ - (void)diff_cleanupEfficiency:(NSMutableArray *)diffs;
11581158
[equalities addObject:[NSNumber numberWithInteger:thisPointer]];
11591159
pre_ins = post_ins;
11601160
pre_del = post_del;
1161-
lastequality = thisDiff.text;
1161+
lastEquality = thisDiff.text;
11621162
} else {
11631163
// Not a candidate, and can never become one.
11641164
[equalities removeAllObjects];
1165-
lastequality = nil;
1165+
lastEquality = nil;
11661166
}
11671167
post_ins = post_del = NO;
11681168
} else { // An insertion or deletion.
@@ -1179,13 +1179,13 @@ - (void)diff_cleanupEfficiency:(NSMutableArray *)diffs;
11791179
* <ins>A</del>X<ins>C</ins><del>D</del>
11801180
* <ins>A</ins><del>B</del>X<del>C</del>
11811181
*/
1182-
if (lastequality != nil
1182+
if (lastEquality != nil
11831183
&& ((pre_ins && pre_del && post_ins && post_del)
1184-
|| ((lastequality.length < Diff_EditCost / 2)
1184+
|| ((lastEquality.length < Diff_EditCost / 2)
11851185
&& ((pre_ins ? 1 : 0) + (pre_del ? 1 : 0) + (post_ins ? 1 : 0)
11861186
+ (post_del ? 1 : 0)) == 3))) {
11871187
// Duplicate record.
1188-
[diffs insertObject:[Diff diffWithOperation:DIFF_DELETE andText:lastequality]
1188+
[diffs insertObject:[Diff diffWithOperation:DIFF_DELETE andText:lastEquality]
11891189
atIndex:equalitiesLastValue];
11901190
// Change second copy to insert.
11911191
// Hash values for objects must not change while in a collection
@@ -1197,7 +1197,7 @@ - (void)diff_cleanupEfficiency:(NSMutableArray *)diffs;
11971197
[diffToChange release];
11981198

11991199
[equalities removeLastObject]; // Throw away the equality we just deleted.
1200-
lastequality = nil;
1200+
lastEquality = nil;
12011201
if (pre_ins && pre_del) {
12021202
// No changes made which could affect previous entry, keep going.
12031203
post_ins = post_del = YES;
@@ -1521,7 +1521,7 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
15211521
// Stack of indices where equalities are found.
15221522
NSMutableArray *equalities = [NSMutableArray array];
15231523
// Always equal to equalities.lastObject.text
1524-
NSString *lastequality = nil;
1524+
NSString *lastEquality = nil;
15251525
NSUInteger thisPointer = 0; // Index of current position.
15261526
// Number of characters that changed prior to the equality.
15271527
NSUInteger length_insertions1 = 0;
@@ -1540,7 +1540,7 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
15401540
length_deletions1 = length_deletions2;
15411541
length_insertions2 = 0;
15421542
length_deletions2 = 0;
1543-
lastequality = thisDiff.text;
1543+
lastEquality = thisDiff.text;
15441544
} else { // an insertion or deletion
15451545
if (thisDiff.operation == DIFF_INSERT) {
15461546
length_insertions2 += thisDiff.text.length;
@@ -1549,11 +1549,11 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
15491549
}
15501550
// Eliminate an equality that is smaller or equal to the edits on both
15511551
// sides of it.
1552-
if (lastequality != nil
1553-
&& (lastequality.length <= MAX(length_insertions1, length_deletions1))
1554-
&& (lastequality.length <= MAX(length_insertions2, length_deletions2))) {
1552+
if (lastEquality != nil
1553+
&& (lastEquality.length <= MAX(length_insertions1, length_deletions1))
1554+
&& (lastEquality.length <= MAX(length_insertions2, length_deletions2))) {
15551555
// Duplicate record.
1556-
[diffs insertObject:[Diff diffWithOperation:DIFF_DELETE andText:lastequality] atIndex:equalitiesLastValue];
1556+
[diffs insertObject:[Diff diffWithOperation:DIFF_DELETE andText:lastEquality] atIndex:equalitiesLastValue];
15571557
// Change second copy to insert.
15581558
// Hash values for objects must not change while in a collection.
15591559
indexToChange = equalitiesLastValue + 1;
@@ -1576,7 +1576,7 @@ - (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
15761576
length_deletions1 = 0;
15771577
length_insertions2 = 0;
15781578
length_deletions2 = 0;
1579-
lastequality = nil;
1579+
lastEquality = nil;
15801580
changes = YES;
15811581
}
15821582
}

0 commit comments

Comments
 (0)