소스 검색

bug report: code clean up

Gleb Pinigin 11 년 전
부모
커밋
9349e72c6d
1개의 변경된 파일8개의 추가작업 그리고 14개의 파일을 삭제
  1. 8 14
      AspenProject/VLCBugreporter.m

+ 8 - 14
AspenProject/VLCBugreporter.m

@@ -12,27 +12,21 @@
 
 @implementation VLCBugreporter
 
-static VLCBugreporter *_sharedInstance = nil;
+#pragma mark - Initialization
 
 + (VLCBugreporter *)sharedInstance
 {
-    return _sharedInstance ? _sharedInstance : [[self alloc] init];
-}
-
-#pragma mark -
-#pragma mark Initialization
-
-- (id)init
-{
-    if (_sharedInstance) {
-        self = nil;
-        return _sharedInstance;
-    } else
-        _sharedInstance = [super init];
+    static dispatch_once_t onceToken;
+    static VLCBugreporter *_sharedInstance = nil;
+    dispatch_once(&onceToken, ^{
+        _sharedInstance = [VLCBugreporter new];
+    });
 
     return _sharedInstance;
 }
 
+#pragma mark -
+
 - (void)handleBugreportRequest
 {
     UIAlertView *alert = [[UIAlertView alloc]