<commit_before>//
//  IBASynthesizeSingleton.h
//  Copyright 2009 <NAME>. All rights reserved.
//
//  Modified by <NAME>.
//
//  Permission is given to use this source code file without charge in any
//  project, commercial or otherwise, entirely at your risk, with the condition
//  that any redistribution (in part or whole) of source code must retain
//  this copyright and permission notice. Attribution in compiled projects is
//  appreciated but not required.
//

#define IBA_SYNTHESIZE_SINGLETON_FOR_CLASS(classname, accessorname) \
static classname *shared##classname = nil; \
+ (void)cleanupFromTerminate \
{ \
    classname *temp = shared##classname; \
    shared##classname = nil; \
    [temp dealloc]; \
} \
+ (void)registerForCleanup \
{ \
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cleanupFromTerminate) name:UIApplicationWillTerminateNotification object:nil]; \
} \
+ (classname *)accessorname \
{ \
    @synchronized(self) \
    { \
        if (shared##classname == nil) \
        { \
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
            shared##classname = [[self alloc] init]; \
            [self registerForCleanup]; \
            [pool drain]; \
        } \
    } \
    return shared##classname; \
} \
+ (id)allocWithZone:(NSZone *)zone \
{ \
    @synchronized(self) \
    { \
        if (shared##classname == nil) \
        { \
            shared##classname = [super allocWithZone:zone]; \
            return shared##classname; \
        } \
    } \
    return nil; \
} \
- (id)copyWithZone:(NSZone *)zone { return self; } \
- (id)retain { return self; } \
- (NSUInteger)retainCount { return NSUIntegerMax; } \<commit_msg>Converted IBA_SYNTHESIZE_SINGLETON_FOR_CLASS to use GCD dispatch_once.<commit_after>//
//  IBASynthesizeSingleton.h
//  Copyright 2009 <NAME>. All rights reserved.
//
//  Modified by <NAME>.
//
//  Permission is given to use this source code file without charge in any
//  project, commercial or otherwise, entirely at your risk, with the condition
//  that any redistribution (in part or whole) of source code must retain
//  this copyright and permission notice. Attribution in compiled projects is
//  appreciated but not required.
//

#define IBA_SYNTHESIZE_SINGLETON_FOR_CLASS(classname, accessorname) \
static classname *shared##classname = nil; \
+ (void)cleanupFromTerminate \
{ \
    classname *temp = shared##classname; \
    shared##classname = nil; \
    [temp dealloc]; \
} \
+ (void)registerForCleanup \
{ \
    [[NSNotificationCenter defaultCenter] addObserver:self \
                                             selector:@selector(cleanupFromTerminate) \
                                                 name:UIApplicationWillTerminateNotification \
                                               object:nil]; \
} \
+ (classname *)accessorname \
{ \
    static dispatch_once_t p; \
    dispatch_once(&p, \
    ^{ \
        if (shared##classname == nil) \
        { \
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; \
            shared##classname = [[self alloc] init]; \
            [self registerForCleanup]; \
            [pool drain]; \
        } \
    }); \
    return shared##classname; \
} \
+ (id)allocWithZone:(NSZone *)zone \
{ \
    static dispatch_once_t p; \
    __block classname* temp = nil; \
    dispatch_once(&p, \
    ^{ \
        if (shared##classname == nil) \
        { \
            temp = shared##classname = [super allocWithZone:zone]; \
        } \
    }); \
    return temp; \
} \
- (id)copyWithZone:(NSZone *)zone { return self; } \
- (id)retain { return self; } \
- (NSUInteger)retainCount { return NSUIntegerMax; } \
{'fraction_non_alphanumeric': 0.12523667838788208, 'fraction_numerical': 0.0021639166892074655, 'mean_word_length': 2.3587647593097185, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4426826', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1092, 'n_words': 268}