Bladeren bron

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

tarfeef101 7 jaren geleden
bovenliggende
commit
5d68b71492
1 gewijzigde bestanden met toevoegingen van 5 en 4 verwijderingen
  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