1. Dave Dribin
  2. DDAudioQueue

Commits

Dave Dribin  committed 7992b53

Initialze the static fence buffer at compile time instead of +initialize

  • Participants
  • Parent commits e4d2382
  • Branches default

Comments (0)

Files changed (1)

File Source/DDAudioQueue.m

View file
 
 #define NODE_OFFSET offsetof(DDAudioQueueListNode, next)
 
-static DDAudioQueueListNode sFenceNode;
+static DDAudioQueueListNode sFenceNode = {
+    .buffer = {
+        .capacity = 0,
+        .length = 0,
+        .bytes = NULL,
+    },
+    .next = NULL,
+};
 DDAudioQueueBuffer * DDAudioQueueFenceBuffer = &sFenceNode.buffer;
 
 static void MyPerformCallback(void * info);
 
 @implementation DDAudioQueue
 
-+ (void)initialize
-{
-    if (self != [DDAudioQueue class]) {
-        return;
-    }
-    
-    DDAudioQueueBuffer tempBuffer = {
-        .capacity = 0,
-        .length = 0,
-        .bytes = NULL,
-    };
-    memcpy(DDAudioQueueFenceBuffer, &tempBuffer, sizeof(DDAudioQueueFenceBuffer));
-}
-
 - (id)initWithDelegate:(id<DDAudioQueueDelegate>)delegate;
 {
     self = [super init];