diff --git a/cv6/a_station.c b/cv6/a_station.c index 5a1d542..d4905fb 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -1,28 +1,15 @@ #include "a_station.h" #include #include +#include struct station* create_station(){ - struct station* station = (struct station*)calloc(1,sizeof(struct station)); - station->tracks = (struct car**)calloc(STATION_SIZE, sizeof(struct car*)); - station->track_count = STATION_SIZE; + struct station* station = (struct station*)calloc(1,sizeof(struct station)); + station->tracks = (struct car**)calloc(STATION_SIZE, sizeof(struct car*)); + station->track_count = STATION_SIZE; - return station; + return station; } -/*unsigned long hash(char *key, size_t len){ - unsigned long hash; - int i; - for(hash = i = 0; i < len; ++i) - { hash += key[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - return hash; -}*/ - void destroy_station(struct station* station){ //struct car* del =prev; for(int i=0;i>station->track_count;i++){ @@ -33,9 +20,7 @@ void destroy_station(struct station* station){ prev=del->next; free(del); } - } - free(station->tracks); free(station); }