Correct the creation of the hash table used for absolute time zones.

This commit is contained in:
rfm 2024-11-18 15:34:53 +00:00
parent 67eeb932d1
commit eeff6e08a7

View file

@ -225,6 +225,7 @@ static NSString *tzdir = nil;
static GSPlaceholderTimeZone *defaultPlaceholderTimeZone;
static NSMapTable *placeholderMap;
static GSAbsTimeZone *commonAbsolutes[145] = { 0 };
static NSMapTable *absolutes = 0;
/*
* Temporary structure for holding time zone details.
@ -638,19 +639,6 @@ static NSString *_time_zone_path(NSString *subpath, NSString *type)
@implementation GSAbsTimeZone
static int uninitialisedOffset = 100000;
static NSMapTable *absolutes = 0;
+ (void) initialize
{
static BOOL beenHere = NO;
if (NO == beenHere && self == [GSAbsTimeZone class])
{
beenHere = YES;
absolutes = NSCreateMapTable(NSIntegerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
}
}
- (NSString*) abbreviationForDate: (NSDate*)aDate
{
@ -1353,14 +1341,18 @@ static NSMapTable *absolutes = 0;
GSPlaceholderTimeZoneClass = [GSPlaceholderTimeZone class];
zoneDictionary = [[NSMutableDictionary alloc] init];
/*
* Set up infrastructure for placeholder timezones.
/* Set up infrastructure for placeholder timezones.
*/
defaultPlaceholderTimeZone = (GSPlaceholderTimeZone*)
NSAllocateObject(GSPlaceholderTimeZoneClass, 0, NSDefaultMallocZone());
placeholderMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSNonRetainedObjectMapValueCallBacks, 0);
/* Hash table lookup for absolute time zones.
*/
absolutes = NSCreateMapTable(NSIntegerMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
localTimeZone = [[NSLocalTimeZone alloc] init];
[[NSNotificationCenter defaultCenter] addObserver: self