diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-03-12 09:25:39 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-03-12 09:25:39 -0700 |
commit | 4c7939b96eddb53f1700edfaea7abe1fa5b0e886 (patch) | |
tree | 1c7ce6868f47697bf6ad2df5553973f54d2e80ed /platform | |
parent | 28e28934c74b0f8668020de03caf61d65a9c9842 (diff) | |
download | qtlocation-mapboxgl-4c7939b96eddb53f1700edfaea7abe1fa5b0e886.tar.gz |
Avoid building a redundant array
Followup to 28e28934c74b0f8668020de03caf61d65a9c9842.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLMapView.mm | 11 |
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]; |