Skip to content

Commit

Permalink
Merge pull request SDWebImage#1076 from ikesyo/faild-urls-nsset
Browse files Browse the repository at this point in the history
[Refactor] Use NSMutableSet for failed URLs' storage instead of array
  • Loading branch information
bpoplauschi committed Mar 18, 2015
2 parents d41bfaf + 210c13d commit 27e3038
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions SDWebImage/SDWebImageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ @interface SDWebImageManager ()

@property (strong, nonatomic, readwrite) SDImageCache *imageCache;
@property (strong, nonatomic, readwrite) SDWebImageDownloader *imageDownloader;
@property (strong, nonatomic) NSMutableArray *failedURLs;
@property (strong, nonatomic) NSMutableSet *failedURLs;
@property (strong, nonatomic) NSMutableArray *runningOperations;

@end
Expand All @@ -41,7 +41,7 @@ - (id)init {
if ((self = [super init])) {
_imageCache = [self createCache];
_imageDownloader = [SDWebImageDownloader sharedDownloader];
_failedURLs = [NSMutableArray new];
_failedURLs = [NSMutableSet new];
_runningOperations = [NSMutableArray new];
}
return self;
Expand Down Expand Up @@ -194,9 +194,7 @@ - (void)diskImageExistsForURL:(NSURL *)url

if (error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut) {
@synchronized (self.failedURLs) {
if (![self.failedURLs containsObject:url]) {
[self.failedURLs addObject:url];
}
[self.failedURLs addObject:url];
}
}
}
Expand Down

0 comments on commit 27e3038

Please sign in to comment.