Quellcode durchsuchen

first batch of compile error fixes. typedef isn't working...

tarfeef101 vor 7 Jahren
Ursprung
Commit
bf69518564
1 geänderte Dateien mit 11 neuen und 15 gelöschten Zeilen
  1. 11 15
      kern/synchprobs/traffic_synch.c

+ 11 - 15
kern/synchprobs/traffic_synch.c

@@ -44,14 +44,13 @@ list * queue = NULL;
 list * active = NULL;
 
 // car initializer/allocator
-car * newcar(Direction origin, Direction dest)
+struct car * newcar(Direction origin, Direction dest)
 {
   car * temp = kmalloc(sizeof(car));
   
   if(!(temp))
   {
-    kprintf("Failed to create a car.");
-    panic();
+    panic("Failed to create a car.");
   }
   
   temp->origin = origin;
@@ -62,14 +61,13 @@ car * newcar(Direction origin, Direction dest)
 }
 
 // list initializer/allocator
-list * newlist()
+struct list * newlist()
 {
   list * temp = kmalloc(sizeof(list));
   
   if(!(temp))
   {
-    kprintf("Could not allocate list.");
-    panic();
+    panic("Could not allocate list.");
   }
   
   temp->front = NULL;
@@ -112,7 +110,7 @@ void push(car * newcar)
 }
 
 // remove an element from the front of the queue
-car * pop()
+struct car * pop()
 {
   if (!(queue->front))
   {
@@ -132,13 +130,13 @@ car * pop()
 // called when a car clears the intersection
 void clearint(car * done)
 {
-  car * temp = active->front();
+  car * temp = active->front;
   car * temp2 = NULL;
   
   while(temp != done)
   {
-    temp = active->next;
     temp2 = temp;
+    temp = temp>next;
   }
   
   // first element of the list is being removed
@@ -180,7 +178,7 @@ void dellist(list * dead)
 bool rightturn(car * car)
 {
   int temp = car->origin - car->dest;
-  return (temp == 1 || temp == -3)
+  return (temp == 1 || temp == -3);
 }
 
 /*
@@ -190,15 +188,13 @@ bool rightturn(car * car)
  * You can use it to initialize synchronization and other variables.
  *
  */
-void
-intersection_sync_init()
+void intersection_sync_init()
 {
   globlock = lock_create("lightlock");
   
   if (!(globlock))
   {
-    kprintf("Failed to create lock!");
-    panic();
+    panic("Failed to create lock!");
   }
   
   queue = newlist();
@@ -297,7 +293,7 @@ void intersection_before_entry(Direction origin, Direction destination)
 
 void intersection_after_exit(Direction origin, Direction destination)
 {
-  car * temp = active->first;
+  car * temp = active->front;
   
   while (temp)
   {