diff src/parallel_execution/main.c @ 101:8987cf13d5bb

Add Allocate macro
author innparusu
date Wed, 02 Mar 2016 19:23:00 +0900
parents 3e28ee215c0e
children 64c98838a291
line wrap: on
line diff
--- a/src/parallel_execution/main.c	Tue Feb 02 16:12:34 2016 +0900
+++ b/src/parallel_execution/main.c	Wed Mar 02 19:23:00 2016 +0900
@@ -258,16 +258,16 @@
 int main(int argc, char** argv) {
     init(argc, argv);
 
-    array_ptr = (int*)malloc(sizeof(int)*length);
+    array_ptr = NEWN(length, int);
 
     for(int i=0; i<length; i++)
         array_ptr[i]=i;
 
-    struct Context* main_context = (struct Context*)malloc(sizeof(struct Context));
+    struct Context* main_context = NEW(struct Context);
     initContext(main_context);
     main_context->next = CreateData1;
 
-    struct Context* worker_contexts = (struct Context*)malloc(sizeof(struct Context)*cpu_num);
+    struct Context* worker_contexts = NEWN(cpu_num, struct Context);
     
     struct Worker* worker = &main_context->data[Worker]->worker;
     worker->num = cpu_num;