cv6
This commit is contained in:
parent
c49dd96c13
commit
3bc100aab9
@ -10,10 +10,20 @@ struct station* create_station(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void destroy_station(struct station* station){
|
void destroy_station(struct station* station){
|
||||||
|
void destroy_station(struct station* station) {
|
||||||
|
if (station == NULL) return;
|
||||||
|
for (int i = 0; i < station->track_count; i++) {
|
||||||
|
struct car* current = station->tracks[i];
|
||||||
|
while (current != NULL) {
|
||||||
|
struct car* temp = current;
|
||||||
|
current = current->next;
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(station->tracks);
|
free(station->tracks);
|
||||||
free(station->track_count);
|
free(station);
|
||||||
station->tracks = NULL;
|
}
|
||||||
station->track_count = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int select_track(struct station* station, const char* target){
|
int select_track(struct station* station, const char* target){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user