tarfeef101 6 年之前
父節點
當前提交
84fd682305
共有 1 個文件被更改,包括 14 次插入15 次删除
  1. 14 15
      kern/synchprobs/traffic_synch.c

+ 14 - 15
kern/synchprobs/traffic_synch.c

@@ -127,21 +127,6 @@ void intersection_sync_init()
   
   // initilaize array of active cars
   activeinit();
-  
-  // represents offests for the origin coordinate in our array
-  dirs = kmalloc(4 * sizeof(int));
-  *dirs = 0;
-  *(dirs + 1) = 3;
-  *(dirs + 2) = 6;
-  *(dirs + 3) = 9;
-
-  // holds the 4 offests for the dest coordinate in our array
-  compass = kmalloc(4 * sizeof(int *));
-  *compass = northa;
-  *(compass + 1) = easta;
-  *(compass + 2) = southa;
-  *(compass + 3) = westa;
-
 
   // represents offests for the dest coordinate in our array
   northa = kmalloc(4 * sizeof(int));
@@ -171,6 +156,20 @@ void intersection_sync_init()
   *(westa + 2) = 2;
   *(westa + 3) = 0;
   
+  // represents offests for the origin coordinate in our array
+  dirs = kmalloc(4 * sizeof(int));
+  *dirs = 0;
+  *(dirs + 1) = 3;
+  *(dirs + 2) = 6;
+  *(dirs + 3) = 9;
+  
+  // holds the 4 offests for the dest coordinate in our array
+  compass = kmalloc(4 * sizeof(int *));
+  *compass = northa;
+  *(compass + 1) = easta;
+  *(compass + 2) = southa;
+  *(compass + 3) = westa;
+  
   if ((!compass) || !(dirs) || !(northa) || !(easta) || !(southa) || !(westa))
   {
     panic("Could not allocate offset arrays.\n");