aCOM TO NEJDE
This commit is contained in:
parent
64f9a186de
commit
16be58f769
@ -1,28 +1,15 @@
|
||||
#include "a_station.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user