From ed4edceb64ff7b96d2bc9cf2e6185fe7a5e9bcd3 Mon Sep 17 00:00:00 2001 From: Anzhelika Nikolaieva Date: Mon, 6 Nov 2023 20:42:19 +0000 Subject: [PATCH] Update 'cv7/a_station.c' --- cv7/a_station.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cv7/a_station.c b/cv7/a_station.c index 0433671..9f418dd 100644 --- a/cv7/a_station.c +++ b/cv7/a_station.c @@ -33,14 +33,7 @@ int select_track(struct station* station, const char* target){ } void add_target_capacity(struct station* station,const char* target, int capacity){ - int track = select_track(station, target); - struct car* new_car = (struct car*)malloc(sizeof(struct car)); - while (aktualna != NULL) { - if (strcmp(aktualna->value, target) == 0) { - return; - } - aktualna = aktualna->next; - } + int track = select_track(station, target); struct car* new_car = (struct car*)malloc(sizeof(struct car)); strncpy(new_car->value, target, TARGET_SIZE); new_car->capacity = capacity; @@ -48,6 +41,7 @@ void add_target_capacity(struct station* station,const char* target, int capacit station->tracks[track] = new_car; } + int get_target_capacity(struct station* station,const char* target){ int track = select_track(station, target); struct car* aktualna = station->tracks[track];