Skip to content

Commit

Permalink
Add FLEX_DISABLE_CTORS, close #471
Browse files Browse the repository at this point in the history
  • Loading branch information
NSExceptional committed Oct 22, 2020
1 parent fcca09e commit 0d676e2
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Classes/Utility/FLEXUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@
#import <zlib.h>

BOOL FLEXConstructorsShouldRun() {
static BOOL _FLEXConstructorsShouldRun_storage = YES;

static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *key = @"FLEX_SKIP_INIT";
if (getenv(key.UTF8String) || [NSUserDefaults.standardUserDefaults boolForKey:key]) {
_FLEXConstructorsShouldRun_storage = NO;
}
});

return _FLEXConstructorsShouldRun_storage;
#if FLEX_DISABLE_CTORS
return NO;
#else
static BOOL _FLEXConstructorsShouldRun_storage = YES;

static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *key = @"FLEX_SKIP_INIT";
if (getenv(key.UTF8String) || [NSUserDefaults.standardUserDefaults boolForKey:key]) {
_FLEXConstructorsShouldRun_storage = NO;
}
});

return _FLEXConstructorsShouldRun_storage;
#endif
}

@implementation FLEXUtility
Expand Down

0 comments on commit 0d676e2

Please sign in to comment.