Skip to content

Commit f3171c1

Browse files
author
Mike Richter
committed
Pull loop-invariant expression out of loop #18463
1 parent 7085e04 commit f3171c1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Source/class-dump.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,10 @@ int main(int argc, char *argv[])
617617
if (range.location != NSNotFound) {
618618
// In Xcode 11, the directories were reordered. Prefer the Xcode 11 order.
619619
NSUInteger start = range.location + range.length;
620+
NSRange replaceablePart = NSMakeRange(start, [sdkRoot length] - start);
620621
for (NSString *simulator in [NSArray arrayWithObjects:@"iPhoneOS.platform/Library/Developer", @"iPhoneOS.platform/Developer/Library", nil]) {
621622
NSString *candidate = [simulator stringByAppendingString:@"/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot"];
622-
NSString *root = [sdkRoot stringByReplacingCharactersInRange:NSMakeRange(start, [sdkRoot length] - start) withString:candidate];
623+
NSString *root = [sdkRoot stringByReplacingCharactersInRange:replaceablePart withString:candidate];
623624
if ([fileManager fileExistsAtPath:root]) {
624625
return root;
625626
}

0 commit comments

Comments
 (0)