summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-03-12 09:25:39 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-03-12 09:25:39 -0700
commit4c7939b96eddb53f1700edfaea7abe1fa5b0e886 (patch)
tree1c7ce6868f47697bf6ad2df5553973f54d2e80ed /platform
parent28e28934c74b0f8668020de03caf61d65a9c9842 (diff)
downloadqtlocation-mapboxgl-4c7939b96eddb53f1700edfaea7abe1fa5b0e886.tar.gz
Avoid building a redundant array
Followup to 28e28934c74b0f8668020de03caf61d65a9c9842.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapView.mm11
1 files changed, 5 insertions, 6 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 76415432ea..d9390ef178 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -947,18 +947,17 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
_bundledStyleNames = [NSMutableArray array];
NSArray *bundledStyleNamesWithExtensions = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:stylesPath error:nil];
- // Add satellite raster & "hybrid" (satellite raster + vector contours & labels)
NSString *hybridStylePrefix = @"hybrid-";
NSString *satelliteStylePrefix = @"satellite-";
- NSMutableArray *hybridStyleNames = [NSMutableArray array];
- for (NSString *styleName in bundledStyleNamesWithExtensions) {
- [_bundledStyleNames addObject:[styleName stringByDeletingPathExtension]];
+ for (NSString *fileName in bundledStyleNamesWithExtensions) {
+ NSString *styleName = [fileName stringByDeletingPathExtension];
+ [_bundledStyleNames addObject:styleName];
+ // Add satellite raster & "hybrid" (satellite raster + vector contours & labels)
if ([styleName hasPrefix:satelliteStylePrefix]) {
- [hybridStyleNames addObject:[hybridStylePrefix stringByAppendingString:[[styleName substringFromIndex:[satelliteStylePrefix length]] stringByDeletingPathExtension]]];
+ [_bundledStyleNames addObject:[hybridStylePrefix stringByAppendingString:[styleName substringFromIndex:[satelliteStylePrefix length]]]];
}
}
- [_bundledStyleNames addObjectsFromArray:hybridStyleNames];
}
return [NSArray arrayWithArray:_bundledStyleNames];