Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.
/ sockit Public archive
forked from NimbusKit/sockit

Commit

Permalink
Cache nonParameterCharacterSet to help minimize memory footprint in m…
Browse files Browse the repository at this point in the history
…ultithreaded apps using SOCKit

Relevant github.com pull request into SOCKit is located here: NimbusKit#26
  • Loading branch information
Boris Suvorov committed Jul 7, 2015
1 parent 332441c commit bcdea2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SOCKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ - (id)copyWithZone:(NSZone *)zone {

- (NSCharacterSet *)nonParameterCharacterSet {
static NSCharacterSet* staticNonParameterCharacterSet = nil;
if (staticNonParameterCharacterSet == nil) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSMutableCharacterSet* parameterCharacterSet = [NSMutableCharacterSet alphanumericCharacterSet];
[parameterCharacterSet addCharactersInString:@".@_"];
staticNonParameterCharacterSet = [parameterCharacterSet invertedSet];
}
});

return staticNonParameterCharacterSet;
}

Expand Down

0 comments on commit bcdea2a

Please sign in to comment.