Added LTO and fixed warnings
This commit is contained in:
parent
3e450b5909
commit
15fb694d7b
3 changed files with 25 additions and 20 deletions
10
connect4.c
10
connect4.c
|
|
@ -128,10 +128,10 @@ int main( int argc, char *argv[] ){
|
|||
}
|
||||
return 0;
|
||||
case 'c': // --columns
|
||||
playboard.columns = atoi(optarg);
|
||||
playboard.columns = (columnsint_t)atoi(optarg);
|
||||
break;
|
||||
case 'r': // --rows
|
||||
playboard.rows = atoi(optarg);
|
||||
playboard.rows = (rowsint_t)atoi(optarg);
|
||||
break;
|
||||
case 'o':
|
||||
filename = strdup(optarg);
|
||||
|
|
@ -169,6 +169,10 @@ int main( int argc, char *argv[] ){
|
|||
// Allocate the board
|
||||
playboard.height = calloc( playboard.columns, sizeof(rowsint_t) );
|
||||
playboard.column = calloc( playboard.columns, sizeof(column_t) );
|
||||
if( playboard.height == NULL || playboard.column == NULL ){
|
||||
fprintf( stderr, "ERROR: COULD NOT ALLOCATE BOARD" );
|
||||
return 1;
|
||||
}
|
||||
// Initialize wins struct if used
|
||||
if( wins != NULL ){
|
||||
wins->win0 = calloc( playboard.columns, sizeof(column_t) );
|
||||
|
|
@ -181,7 +185,9 @@ int main( int argc, char *argv[] ){
|
|||
wins->same.horizontal4 = calloc( playboard.columns, sizeof(column_t) );
|
||||
wins->same.diagonalUp4 = calloc( playboard.columns, sizeof(column_t) );
|
||||
wins->same.diagonalDown4 = calloc( playboard.columns, sizeof(column_t) );
|
||||
goto init_ui;
|
||||
}
|
||||
init_ui:
|
||||
initBoard( playboard );
|
||||
// Begin loopin
|
||||
if( outputfile != NULL ){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue