******** fig5.15 ********** HASH_TABLE initialize_table( unsigned int table_size ) { HASH_TABLE H; int i; /*1*/ if( table_size < MIN_TABLE_SIZE ) { /*2*/ error("Table size too small"); /*3*/ return NULL; } /*4*/ H = (HASH_TABLE) malloc( sizeof( struct hash_tbl ) ); /* Allocate table */ /*5*/ if( H == NULL ) /*6*/ fatal_error("Out of space!!!"); /*7*/ H->table_size = next_prime( table_size ); /* Allocate cells */ /*8*/ H->the_cells = (cell *) malloc( sizeof( cell ) * H->table_size ); /*9*/ if( H->the_cells == NULL ) /*10*/ fatal_error("Out of space!!!"); /*11*/ for(i=0; itable_size; i++ ) /*12*/ H->the_cells[i].info = empty; /*13*/ return H; }