diff --git a/ du6/a_station.c b/ du6/a_station.c index 8297e13..0cd0aa9 100644 --- a/ du6/a_station.c +++ b/ du6/a_station.c @@ -27,7 +27,7 @@ int select_track(struct station* station, const char* target) { unsigned long hash = 5381; int c; while ((c = (unsigned char)*target++)) { - hash = ((hash << 5) + hash) + c; // hash * 33 + c + hash = ((hash << 5) + hash) + c; } return (int)(hash % (unsigned long)station->track_count); } @@ -36,7 +36,6 @@ void add_target_capacity(struct station* station, const char* target, int capaci int index = select_track(station, target); struct car* current = station->tracks[index]; - // Hladame existujuci zaznam while (current != NULL) { if (strncmp(current->value, target, TARGET_SIZE) == 0) { current->capacity += capacity; @@ -45,7 +44,6 @@ void add_target_capacity(struct station* station, const char* target, int capaci current = current->next; } - // Zaznam neexistuje - vytvorime novy na zaciatku zoznamu struct car* new_car = (struct car*)calloc(1, sizeof(struct car)); strncpy(new_car->value, target, TARGET_SIZE - 1); new_car->value[TARGET_SIZE - 1] = '\0';