Преглед на файлове

changing goto to else condition. i love goto and all, but objectively should do this

tarfeef101 преди 7 години
родител
ревизия
5d68b71492
променени са 1 файла, в които са добавени 5 реда и са изтрити 4 реда
  1. 5 4
      kern/synchprobs/traffic_synch.c

+ 5 - 4
kern/synchprobs/traffic_synch.c

@@ -111,12 +111,13 @@ static void clearint(car * done)
     }
     
     active->front = active->front->next;
-    goto SKIP1;
+  }
+  else
+  {
+    // we are removing the middle or end, so we can set the previous to point to the element after the removed
+    temp2->next = temp->next;
   }
   
-  temp2->next = temp->next;
-  SKIP1:
-
   if (temp->cv) // if this car was blocking something
   {
     cv_broadcast(temp->cv, globlock); // wake all/inform them you're all good