mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Now that NSCharacterSet's does its own caching, simplify this code.
(Changes from Eric Norum <Eric.Norum@usask.ca>.) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1705 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fecb3e568c
commit
b922ca0a1e
1 changed files with 3 additions and 22 deletions
|
@ -28,25 +28,8 @@
|
|||
#include <math.h>
|
||||
#include <ctype.h> /* FIXME: May go away once I figure out Unicode */
|
||||
|
||||
/*
|
||||
* Cache the default NSCharacterSet of characters to be skipped.
|
||||
* FIXME: This would be unecessary if NSCharacterSet did the caching.
|
||||
*/
|
||||
static NSCharacterSet *defaultCharactersToBeSkipped;
|
||||
|
||||
@implementation NSScanner
|
||||
|
||||
/*
|
||||
* Class initialization.
|
||||
* Fill in default NSCharacterSet of characters to be skipped.
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (defaultCharactersToBeSkipped == nil)
|
||||
defaultCharactersToBeSkipped =
|
||||
[[NSCharacterSet whitespaceAndNewlineCharacterSet] retain];
|
||||
}
|
||||
|
||||
/*
|
||||
* Create and return a scanner that scans aString.
|
||||
*/
|
||||
|
@ -71,7 +54,7 @@ static NSCharacterSet *defaultCharactersToBeSkipped;
|
|||
[super init];
|
||||
string = [aString copyWithZone: [self zone]];
|
||||
len = [string length];
|
||||
charactersToBeSkipped = defaultCharactersToBeSkipped;
|
||||
charactersToBeSkipped = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -82,8 +65,7 @@ static NSCharacterSet *defaultCharactersToBeSkipped;
|
|||
{
|
||||
[string release];
|
||||
[locale release];
|
||||
if (charactersToBeSkipped != defaultCharactersToBeSkipped)
|
||||
[charactersToBeSkipped release];
|
||||
[charactersToBeSkipped release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -626,8 +608,7 @@ static NSCharacterSet *defaultCharactersToBeSkipped;
|
|||
*/
|
||||
- (void)setCharactersToBeSkipped:(NSCharacterSet *)aSet
|
||||
{
|
||||
if (charactersToBeSkipped != defaultCharactersToBeSkipped)
|
||||
[charactersToBeSkipped release];
|
||||
[charactersToBeSkipped release];
|
||||
charactersToBeSkipped = [aSet copyWithZone: [self zone]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue