mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Experiment with function visibility ... try caching locale dictionary to be
accessed from a function yet invisible outside the base library even when caching is done in the Additions subproject. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23903 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8ec6e389ee
commit
fd98041ec7
15 changed files with 159 additions and 91 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2006-10-18 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSPrivate.m:
|
||||
* Source/Additions/Unicode.m:
|
||||
* Source/GSPrivate.h:
|
||||
* Source/NSArray.m:
|
||||
* Source/NSCalendarDate.m:
|
||||
* Source/NSDate.m:
|
||||
* Source/NSDecimalNumber.m:
|
||||
* Source/NSDictionary.m:
|
||||
* Source/NSNotification.m:
|
||||
* Source/NSObject.m:
|
||||
* Source/NSProcessInfo.m:
|
||||
* Source/NSScanner.m:
|
||||
* Source/NSString.m:
|
||||
* Source/NSUserDefaults.m:
|
||||
Experiments with gcc attribute for making functions inaccessible
|
||||
outside the library ... new experimental function
|
||||
GSPrivateDefaultLocale() declared in GSPrivate.h, implemented in
|
||||
Additions/GSPrivate.m seems to work and to be invisible to the linker
|
||||
for external apps.
|
||||
|
||||
2006-10-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPropertyList.m:
|
||||
|
|
|
@ -47,9 +47,28 @@ strerror(int eno)
|
|||
}
|
||||
#endif
|
||||
|
||||
@implementation _GSPrivate
|
||||
@implementation GSPrivate
|
||||
|
||||
+ (NSString*) error
|
||||
- (void) defaultsChanged: (NSNotification*)n
|
||||
{
|
||||
[gnustep_global_lock lock];
|
||||
if (cachedLocale == nil)
|
||||
{
|
||||
if (n == nil)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: _cmd
|
||||
name: NSUserDefaultsDidChangeNotification
|
||||
object: nil];
|
||||
}
|
||||
ASSIGN(cachedLocale,
|
||||
[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
|
||||
}
|
||||
[gnustep_global_lock unlock];
|
||||
}
|
||||
|
||||
- (NSString*) error
|
||||
{
|
||||
#if defined(__MINGW32__)
|
||||
return [self error: GetLastError()];
|
||||
|
@ -59,7 +78,7 @@ strerror(int eno)
|
|||
#endif
|
||||
}
|
||||
|
||||
+ (NSString*) error: (long)number
|
||||
- (NSString*) error: (long)number
|
||||
{
|
||||
NSString *text;
|
||||
#if defined(__MINGW32__)
|
||||
|
@ -78,3 +97,14 @@ strerror(int eno)
|
|||
}
|
||||
@end
|
||||
|
||||
|
||||
NSDictionary *
|
||||
GSPrivateDefaultLocale()
|
||||
{
|
||||
if (_GSPrivate->cachedLocale == nil)
|
||||
{
|
||||
[_GSPrivate defaultsChanged: nil];
|
||||
}
|
||||
return _GSPrivate->cachedLocale;
|
||||
}
|
||||
|
||||
|
|
|
@ -2043,9 +2043,9 @@ iconv_start:
|
|||
|
||||
#undef GROW
|
||||
|
||||
@implementation _GSPrivate (Unicode)
|
||||
@implementation GSPrivate (Unicode)
|
||||
|
||||
+ (NSStringEncoding*) availableEncodings
|
||||
- (NSStringEncoding*) availableEncodings
|
||||
{
|
||||
if (_availableEncodings == 0)
|
||||
{
|
||||
|
@ -2081,7 +2081,7 @@ iconv_start:
|
|||
return _availableEncodings;
|
||||
}
|
||||
|
||||
+ (NSStringEncoding) defaultCStringEncoding
|
||||
- (NSStringEncoding) defaultCStringEncoding
|
||||
{
|
||||
if (defEnc == GSUndefinedEncoding)
|
||||
{
|
||||
|
@ -2246,7 +2246,7 @@ iconv_start:
|
|||
return defEnc;
|
||||
}
|
||||
|
||||
+ (NSString*) encodingName: (NSStringEncoding)encoding
|
||||
- (NSString*) encodingName: (NSStringEncoding)encoding
|
||||
{
|
||||
if (isEncodingSupported(encoding) == NO)
|
||||
{
|
||||
|
@ -2255,7 +2255,7 @@ iconv_start:
|
|||
return [NSString stringWithUTF8String: encodingTable[encoding]->ename];
|
||||
}
|
||||
|
||||
+ (BOOL) isByteEncoding: (NSStringEncoding)encoding
|
||||
- (BOOL) isByteEncoding: (NSStringEncoding)encoding
|
||||
{
|
||||
if (isEncodingSupported(encoding) == NO)
|
||||
{
|
||||
|
@ -2264,7 +2264,7 @@ iconv_start:
|
|||
return encodingTable[encoding]->eightBit;
|
||||
}
|
||||
|
||||
+ (BOOL) isEncodingSupported: (NSStringEncoding)encoding
|
||||
- (BOOL) isEncodingSupported: (NSStringEncoding)encoding
|
||||
{
|
||||
return isEncodingSupported(encoding);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,16 @@
|
|||
MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __GSPrivate_h_
|
||||
#define __GSPrivate_h_
|
||||
#ifndef _GSPrivate_h_
|
||||
#define _GSPrivate_h_
|
||||
|
||||
@class NSNotification;
|
||||
|
||||
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
|
||||
#define GS_ATTRIB_PRIVATE __attribute__ ((visibility("internal")))
|
||||
#else
|
||||
#define GS_ATTRIB_PRIVATE
|
||||
#endif
|
||||
|
||||
/* Absolute Gregorian date for NSDate reference date Jan 01 2001
|
||||
*
|
||||
|
@ -227,59 +235,71 @@ extern BOOL GSNotifyMore(void);
|
|||
* categories in the files wishing to expose some functionality for use
|
||||
* by other parts of the base library.
|
||||
*/
|
||||
@interface _GSPrivate : NSObject
|
||||
@interface GSPrivate : NSObject
|
||||
{
|
||||
@public
|
||||
NSDictionary *cachedLocale;
|
||||
}
|
||||
|
||||
/* Update information from defaults system
|
||||
*/
|
||||
- (void) defaultsChanged: (NSNotification*)n;
|
||||
|
||||
/* Return the text describing the last system error to have occurred.
|
||||
*/
|
||||
+ (NSString*) error;
|
||||
+ (NSString*) error: (long)number;
|
||||
- (NSString*) error;
|
||||
- (NSString*) error: (long)number;
|
||||
@end
|
||||
|
||||
@interface _GSPrivate (ProcessInfo)
|
||||
extern GSPrivate *_GSPrivate;
|
||||
|
||||
@interface GSPrivate (ProcessInfo)
|
||||
/* Used by NSException uncaught exception handler - must not call any
|
||||
* methods/functions which might cause a recursive exception.
|
||||
*/
|
||||
+ (const char*) argZero;
|
||||
- (const char*) argZero;
|
||||
|
||||
/* get a flag from an environment variable - return def if not defined.
|
||||
*/
|
||||
+ (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def;
|
||||
- (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def;
|
||||
@end
|
||||
|
||||
@interface _GSPrivate (Unicode)
|
||||
@interface GSPrivate (Unicode)
|
||||
/* get the available string encodings (nul terminated array)
|
||||
*/
|
||||
+ (NSStringEncoding*) availableEncodings;
|
||||
- (NSStringEncoding*) availableEncodings;
|
||||
|
||||
/* get the default C-string encoding.
|
||||
*/
|
||||
+ (NSStringEncoding) defaultCStringEncoding;
|
||||
- (NSStringEncoding) defaultCStringEncoding;
|
||||
|
||||
/* get the name of a string encoding as an NSString.
|
||||
*/
|
||||
+ (NSString*) encodingName: (NSStringEncoding)encoding;
|
||||
- (NSString*) encodingName: (NSStringEncoding)encoding;
|
||||
|
||||
/* determine whether data in a particular encoding can
|
||||
* generally be represented as 8-bit characters including ascii.
|
||||
*/
|
||||
+ (BOOL) isByteEncoding: (NSStringEncoding)encoding;
|
||||
- (BOOL) isByteEncoding: (NSStringEncoding)encoding;
|
||||
|
||||
/* determine whether encoding is currently supported.
|
||||
*/
|
||||
+ (BOOL) isEncodingSupported: (NSStringEncoding)encoding;
|
||||
- (BOOL) isEncodingSupported: (NSStringEncoding)encoding;
|
||||
|
||||
@end
|
||||
|
||||
@interface _GSPrivate (UserDefaults)
|
||||
/*
|
||||
* Get the dictionary representation.
|
||||
*/
|
||||
+ (NSDictionary*) userDefaultsDictionaryRepresentation;
|
||||
|
||||
@interface GSPrivate (UserDefaults)
|
||||
/*
|
||||
* Get one of several potentially useful flags.
|
||||
*/
|
||||
+ (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type;
|
||||
- (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type;
|
||||
@end
|
||||
|
||||
#endif /* __GSPrivate_h_ */
|
||||
/* Get default locale quickly (usually from cache).
|
||||
* External apps would cache the locale themselves.
|
||||
*/
|
||||
NSDictionary *
|
||||
GSPrivateDefaultLocale() GS_ATTRIB_PRIVATE;
|
||||
|
||||
#endif /* _GSPrivate_h_ */
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSArray class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
@ -45,6 +46,7 @@
|
|||
#include "Foundation/NSDebug.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSNull.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
// For private method _decodeArrayOfObjectsForKey:
|
||||
#include "Foundation/NSKeyedArchiver.h"
|
||||
#include "GNUstepBase/GSCategories.h"
|
||||
|
@ -1212,10 +1214,11 @@ compare(id elem1, id elem2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSDictionary *loc;
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
if (GSMacOSXCompatiblePropertyLists() == YES)
|
||||
{
|
||||
GSPropertyListMake(self, loc, YES, NO, 2, &desc);
|
||||
|
@ -1238,10 +1241,11 @@ compare(id elem1, id elem2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToURL: (NSURL *)url atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSDictionary *loc;
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
if (GSMacOSXCompatiblePropertyLists() == YES)
|
||||
{
|
||||
GSPropertyListMake(self, loc, YES, NO, 2, &desc);
|
||||
|
|
|
@ -30,20 +30,22 @@
|
|||
|
||||
#include "config.h"
|
||||
#include <math.h>
|
||||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSAutoreleasePool.h"
|
||||
#include "Foundation/NSCalendarDate.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSData.h"
|
||||
#include "Foundation/NSDate.h"
|
||||
#include "Foundation/NSCalendarDate.h"
|
||||
#include "Foundation/NSTimeZone.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
#include "Foundation/NSAutoreleasePool.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSTimeZone.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
#include "GNUstepBase/GSObjCRuntime.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
@ -51,7 +53,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "GSPrivate.h"
|
||||
|
||||
@class GSTimeZone;
|
||||
@interface GSTimeZone : NSObject // Help the compiler
|
||||
|
@ -653,7 +654,7 @@ static inline int getDigits(const char *from, char *to, int limit)
|
|||
sourceLen = strlen(source);
|
||||
if (locale == nil)
|
||||
{
|
||||
locale = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
locale = GSPrivateDefaultLocale();
|
||||
}
|
||||
if (fmt == nil)
|
||||
{
|
||||
|
@ -2191,7 +2192,7 @@ static void Grow(DescriptionInfo *info, unsigned size)
|
|||
DescriptionInfo info;
|
||||
|
||||
if (locale == nil)
|
||||
locale = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
locale = GSPrivateDefaultLocale();
|
||||
if (format == nil)
|
||||
format = [locale objectForKey: NSTimeDateFormatString];
|
||||
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "Foundation/NSArray.h"
|
||||
#include "Foundation/NSDictionary.h"
|
||||
#include "Foundation/NSDate.h"
|
||||
#include "Foundation/NSCalendarDate.h"
|
||||
#include "Foundation/NSTimeZone.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSCharacterSet.h"
|
||||
#include "Foundation/NSScanner.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSDate.h"
|
||||
#include "Foundation/NSDictionary.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "Foundation/NSPortCoder.h"
|
||||
#include "Foundation/NSScanner.h"
|
||||
#include "Foundation/NSString.h"
|
||||
#include "Foundation/NSTimeZone.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
#include "GNUstepBase/GSObjCRuntime.h"
|
||||
|
@ -264,7 +264,7 @@ otherTime(NSDate* other)
|
|||
|
||||
if (locale == nil)
|
||||
{
|
||||
locale = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
locale = GSPrivateDefaultLocale();
|
||||
}
|
||||
ws = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
digits = [NSCharacterSet decimalDigitCharacterSet];
|
||||
|
|
|
@ -26,11 +26,12 @@
|
|||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSDecimal.h"
|
||||
#include "Foundation/NSDecimalNumber.h"
|
||||
#include "Foundation/NSCoder.h"
|
||||
#include "Foundation/NSException.h"
|
||||
#include "Foundation/NSPortCoder.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
// shared default behavior for NSDecimalNumber class
|
||||
|
@ -263,7 +264,7 @@ static NSDecimalNumber *one;
|
|||
- (id) initWithString: (NSString*)numberValue
|
||||
{
|
||||
return [self initWithString: numberValue
|
||||
locale: [_GSPrivate userDefaultsDictionaryRepresentation]];
|
||||
locale: GSPrivateDefaultLocale()];
|
||||
}
|
||||
|
||||
- (id) initWithString: (NSString*)numberValue
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "Foundation/NSObjCRuntime.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
#include "Foundation/NSKeyValueCoding.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
// For private method _decodeArrayOfObjectsForKey:
|
||||
#include "Foundation/NSKeyedArchiver.h"
|
||||
#include "GNUstepBase/GSCategories.h"
|
||||
|
@ -939,10 +940,11 @@ compareIt(id o1, id o2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToFile: (NSString *)path atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSDictionary *loc;
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
if (GSMacOSXCompatiblePropertyLists() == YES)
|
||||
{
|
||||
GSPropertyListMake(self, loc, YES, NO, 2, &desc);
|
||||
|
@ -964,10 +966,11 @@ compareIt(id o1, id o2, void* context)
|
|||
*/
|
||||
- (BOOL) writeToURL: (NSURL *)url atomically: (BOOL)useAuxiliaryFile
|
||||
{
|
||||
NSDictionary *loc = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
NSDictionary *loc;
|
||||
NSString *desc = nil;
|
||||
NSData *data;
|
||||
|
||||
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
if (GSMacOSXCompatiblePropertyLists() == YES)
|
||||
{
|
||||
GSPropertyListMake(self, loc, YES, NO, 2, &desc);
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
|
||||
<title>NSNotification class reference</title>
|
||||
$Date$ $Revision$
|
||||
|
|
|
@ -882,6 +882,8 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
}
|
||||
#endif
|
||||
|
||||
GSPrivate *_GSPrivate = nil;
|
||||
|
||||
/**
|
||||
* This message is sent to a class once just before it is used for the first
|
||||
* time. If class has a superclass, its implementation of +initialize is
|
||||
|
@ -895,6 +897,8 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
|
|||
{
|
||||
extern void GSBuildStrings(void); // See externs.m
|
||||
|
||||
_GSPrivate = [GSPrivate new];
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// See libgnustep-base-entry.m
|
||||
extern void gnustep_base_socket_init(void);
|
||||
|
|
|
@ -1234,8 +1234,8 @@ BOOL GSDebugSet(NSString *level)
|
|||
return YES;
|
||||
}
|
||||
|
||||
@implementation _GSPrivate (ProcessInfo)
|
||||
+ (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def
|
||||
@implementation GSPrivate (ProcessInfo)
|
||||
- (BOOL) environmentFlag: (const char *)name defaultValue: (BOOL)def
|
||||
{
|
||||
const char *c = getenv(name);
|
||||
BOOL a = def;
|
||||
|
@ -1262,7 +1262,7 @@ BOOL GSDebugSet(NSString *level)
|
|||
return a;
|
||||
}
|
||||
|
||||
+ (const char*) argZero
|
||||
- (const char*) argZero
|
||||
{
|
||||
if (_gnu_arg_zero == 0)
|
||||
return "";
|
||||
|
|
|
@ -169,7 +169,10 @@ typedef struct {
|
|||
|
||||
if (scanner != nil)
|
||||
{
|
||||
[scanner setLocale: [_GSPrivate userDefaultsDictionaryRepresentation]];
|
||||
NSDictionary *loc;
|
||||
|
||||
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
|
||||
[scanner setLocale: loc];
|
||||
}
|
||||
return scanner;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#include "Foundation/NSURL.h"
|
||||
#include "Foundation/NSMapTable.h"
|
||||
#include "Foundation/NSLock.h"
|
||||
#include "Foundation/NSNotification.h"
|
||||
#include "Foundation/NSUserDefaults.h"
|
||||
#include "Foundation/NSDebug.h"
|
||||
// For private method _decodePropertyListForKey:
|
||||
|
@ -107,7 +108,6 @@ extern BOOL GSScanDouble(unichar*, unsigned, double*);
|
|||
@interface GSImmutableString : NSObject // Help the compiler
|
||||
@end
|
||||
|
||||
|
||||
/*
|
||||
* Cache classes and method implementations for speed.
|
||||
*/
|
||||
|
@ -454,7 +454,6 @@ surrogatePairValue(unichar high, unichar low)
|
|||
+ ((low - (unichar)0xDC00) + (unichar)10000);
|
||||
}
|
||||
|
||||
|
||||
@implementation NSString
|
||||
// NSString itself is an abstract class which provides factory
|
||||
// methods to generate objects of unspecified subclasses.
|
||||
|
@ -4141,7 +4140,6 @@ static NSFileManager *fm = nil;
|
|||
{
|
||||
va_list ap;
|
||||
id ret;
|
||||
NSDictionary *dict;
|
||||
|
||||
va_start(ap, format);
|
||||
if (format == nil)
|
||||
|
@ -4150,9 +4148,8 @@ static NSFileManager *fm = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
dict = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
ret = AUTORELEASE([[self allocWithZone: NSDefaultMallocZone()]
|
||||
initWithFormat: format locale: dict arguments: ap]);
|
||||
initWithFormat: format locale: GSPrivateDefaultLocale() arguments: ap]);
|
||||
}
|
||||
va_end(ap);
|
||||
return ret;
|
||||
|
@ -4202,12 +4199,10 @@ static NSFileManager *fm = nil;
|
|||
*/
|
||||
- (NSComparisonResult) localizedCompare: (NSString *)string
|
||||
{
|
||||
NSDictionary *dict = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
|
||||
return [self compare: string
|
||||
options: 0
|
||||
range: ((NSRange){0, [self length]})
|
||||
locale: dict];
|
||||
locale: GSPrivateDefaultLocale()];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4216,12 +4211,10 @@ static NSFileManager *fm = nil;
|
|||
*/
|
||||
- (NSComparisonResult) localizedCaseInsensitiveCompare: (NSString *)string
|
||||
{
|
||||
NSDictionary *dict = [_GSPrivate userDefaultsDictionaryRepresentation];
|
||||
|
||||
return [self compare: string
|
||||
options: NSCaseInsensitiveSearch
|
||||
range: ((NSRange){0, [self length]})
|
||||
locale: dict];
|
||||
locale: GSPrivateDefaultLocale()];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1955,23 +1955,9 @@ static BOOL isLocked = NO;
|
|||
}
|
||||
@end
|
||||
|
||||
@implementation _GSPrivate (UserDefaults)
|
||||
@implementation GSPrivate (UserDefaults)
|
||||
|
||||
+ (NSDictionary*) userDefaultsDictionaryRepresentation
|
||||
{
|
||||
NSDictionary *defs;
|
||||
|
||||
if (sharedDefaults == nil)
|
||||
{
|
||||
[NSUserDefaults standardUserDefaults];
|
||||
}
|
||||
[classLock lock];
|
||||
defs = [sharedDefaults dictionaryRepresentation];
|
||||
[classLock unlock];
|
||||
return defs;
|
||||
}
|
||||
|
||||
+ (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type
|
||||
- (BOOL) userDefaultsFlag: (GSUserDefaultFlagType)type
|
||||
{
|
||||
if (sharedDefaults == nil)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue