mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Simplification ... remove internal private functiuon and use public method.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26602 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8c16285f1b
commit
220bf8f040
7 changed files with 29 additions and 39 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2008-06-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSCalendarDate.m:
|
||||||
|
* Source/NSUserDefaults.m:
|
||||||
|
* Source/GSPrivate.h:
|
||||||
|
* Source/NSString.m:
|
||||||
|
* Source/NSDecimalNumber.m:
|
||||||
|
* Source/NSDate.m:
|
||||||
|
Remove GSPrivateDefaultLocale(), as the performance optimisation
|
||||||
|
doesn't seem worth the additional complexity.
|
||||||
|
|
||||||
2008-06-06 Richard Frith-Macdonald <rfm@gnu.org>
|
2008-06-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSTimeZone.m: Monitor to see if the time zone specified in
|
* Source/NSTimeZone.m: Monitor to see if the time zone specified in
|
||||||
|
|
|
@ -318,12 +318,6 @@ GSPrivateCheckTasks(void) GS_ATTRIB_PRIVATE;
|
||||||
NSStringEncoding
|
NSStringEncoding
|
||||||
GSPrivateDefaultCStringEncoding() GS_ATTRIB_PRIVATE;
|
GSPrivateDefaultCStringEncoding() GS_ATTRIB_PRIVATE;
|
||||||
|
|
||||||
/* Get default locale quickly (usually from cache).
|
|
||||||
* External apps would cache the locale themselves.
|
|
||||||
*/
|
|
||||||
NSDictionary *
|
|
||||||
GSPrivateDefaultLocale() GS_ATTRIB_PRIVATE;
|
|
||||||
|
|
||||||
/* Get one of several standard values.
|
/* Get one of several standard values.
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
|
|
|
@ -673,7 +673,7 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error)
|
||||||
sourceLen = strlen(source);
|
sourceLen = strlen(source);
|
||||||
if (locale == nil)
|
if (locale == nil)
|
||||||
{
|
{
|
||||||
locale = GSPrivateDefaultLocale();
|
locale = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||||
}
|
}
|
||||||
if (fmt == nil)
|
if (fmt == nil)
|
||||||
{
|
{
|
||||||
|
@ -2267,7 +2267,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
||||||
DescriptionInfo info;
|
DescriptionInfo info;
|
||||||
|
|
||||||
if (locale == nil)
|
if (locale == nil)
|
||||||
locale = GSPrivateDefaultLocale();
|
locale = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||||
if (format == nil)
|
if (format == nil)
|
||||||
format = [locale objectForKey: NSTimeDateFormatString];
|
format = [locale objectForKey: NSTimeDateFormatString];
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,7 @@ otherTime(NSDate* other)
|
||||||
|
|
||||||
if (locale == nil)
|
if (locale == nil)
|
||||||
{
|
{
|
||||||
locale = GSPrivateDefaultLocale();
|
locale = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||||
}
|
}
|
||||||
ws = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
ws = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||||
digits = [NSCharacterSet decimalDigitCharacterSet];
|
digits = [NSCharacterSet decimalDigitCharacterSet];
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "Foundation/NSDecimalNumber.h"
|
#include "Foundation/NSDecimalNumber.h"
|
||||||
#include "Foundation/NSException.h"
|
#include "Foundation/NSException.h"
|
||||||
#include "Foundation/NSPortCoder.h"
|
#include "Foundation/NSPortCoder.h"
|
||||||
|
#include "Foundation/NSUserDefaults.h"
|
||||||
|
|
||||||
#include "GSPrivate.h"
|
#include "GSPrivate.h"
|
||||||
|
|
||||||
|
@ -356,8 +357,9 @@ static NSDecimalNumber *one;
|
||||||
float v = *(float *)value;
|
float v = *(float *)value;
|
||||||
if (GSIsNAN(v)) return notANumber;
|
if (GSIsNAN(v)) return notANumber;
|
||||||
if (GSIsInf(v)) return (v < 0.0) ? minNumber : maxNumber;
|
if (GSIsInf(v)) return (v < 0.0) ? minNumber : maxNumber;
|
||||||
s = [[NSString alloc] initWithFormat: @"%g"
|
s = [[NSString alloc] initWithFormat: @"%g" locale:
|
||||||
locale: GSPrivateDefaultLocale(), (double)v];
|
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation],
|
||||||
|
(double)v];
|
||||||
self = [self initWithString: s];
|
self = [self initWithString: s];
|
||||||
RELEASE(s);
|
RELEASE(s);
|
||||||
return self;
|
return self;
|
||||||
|
@ -370,8 +372,9 @@ static NSDecimalNumber *one;
|
||||||
double v = *(double *)value;
|
double v = *(double *)value;
|
||||||
if (GSIsNAN(v)) return notANumber;
|
if (GSIsNAN(v)) return notANumber;
|
||||||
if (GSIsInf(v)) return (v < 0.0) ? minNumber : maxNumber;
|
if (GSIsInf(v)) return (v < 0.0) ? minNumber : maxNumber;
|
||||||
s = [[NSString alloc] initWithFormat: @"%g"
|
s = [[NSString alloc] initWithFormat: @"%g" locale:
|
||||||
locale: GSPrivateDefaultLocale(), v];
|
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation],
|
||||||
|
v];
|
||||||
self = [self initWithString: s];
|
self = [self initWithString: s];
|
||||||
RELEASE(s);
|
RELEASE(s);
|
||||||
return self;
|
return self;
|
||||||
|
@ -413,7 +416,7 @@ static NSDecimalNumber *one;
|
||||||
- (id) initWithString: (NSString*)numberValue
|
- (id) initWithString: (NSString*)numberValue
|
||||||
{
|
{
|
||||||
return [self initWithString: numberValue
|
return [self initWithString: numberValue
|
||||||
locale: GSPrivateDefaultLocale()];
|
locale: [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithString: (NSString*)numberValue
|
- (id) initWithString: (NSString*)numberValue
|
||||||
|
|
|
@ -4384,7 +4384,9 @@ static NSFileManager *fm = nil;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
ret = AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||||
initWithFormat: format locale: GSPrivateDefaultLocale() arguments: ap]);
|
initWithFormat: format locale:
|
||||||
|
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
||||||
|
arguments: ap]);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -4437,7 +4439,8 @@ static NSFileManager *fm = nil;
|
||||||
return [self compare: string
|
return [self compare: string
|
||||||
options: 0
|
options: 0
|
||||||
range: ((NSRange){0, [self length]})
|
range: ((NSRange){0, [self length]})
|
||||||
locale: GSPrivateDefaultLocale()];
|
locale:
|
||||||
|
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4449,7 +4452,8 @@ static NSFileManager *fm = nil;
|
||||||
return [self compare: string
|
return [self compare: string
|
||||||
options: NSCaseInsensitiveSearch
|
options: NSCaseInsensitiveSearch
|
||||||
range: ((NSRange){0, [self length]})
|
range: ((NSRange){0, [self length]})
|
||||||
locale: GSPrivateDefaultLocale()];
|
locale:
|
||||||
|
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1872,25 +1872,3 @@ GSPrivateDefaultsFlag(GSUserDefaultFlagType type)
|
||||||
return flags[type];
|
return flags[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME ... Slightly faster than
|
|
||||||
* [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]
|
|
||||||
* but is it really worthwile?
|
|
||||||
*/
|
|
||||||
NSDictionary *GSPrivateDefaultLocale()
|
|
||||||
{
|
|
||||||
NSDictionary *locale;
|
|
||||||
|
|
||||||
if (classLock == nil)
|
|
||||||
{
|
|
||||||
[NSUserDefaults standardUserDefaults];
|
|
||||||
}
|
|
||||||
[classLock lock];
|
|
||||||
if (sharedDefaults == nil)
|
|
||||||
{
|
|
||||||
[NSUserDefaults standardUserDefaults];
|
|
||||||
}
|
|
||||||
locale = [sharedDefaults dictionaryRepresentation];
|
|
||||||
[classLock unlock];
|
|
||||||
return locale;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue