Updated to be fully C99 compatible
This commit is contained in:
parent
b0240c4911
commit
9a8665ed26
2 changed files with 10 additions and 4 deletions
10
connect4.c
10
connect4.c
|
|
@ -143,8 +143,14 @@ int main(
|
|||
playboard.rows = (rowsint_t)atoi(optarg);
|
||||
break;
|
||||
case 'o':
|
||||
filename = strdup(optarg);
|
||||
// filename = strdup(optarg);
|
||||
filename = calloc( strlen( optarg ) + 1, sizeof(char) );
|
||||
if( filename != NULL ){
|
||||
strcpy( filename, optarg );
|
||||
outputfile = fopen( filename, "w" );
|
||||
}else{
|
||||
fprintf( stderr, "ERR: COULD NOT ALLOCATE FILENAME\n" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -185,7 +191,7 @@ int main(
|
|||
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" );
|
||||
fprintf( stderr, "ERROR: COULD NOT ALLOCATE BOARD\n" );
|
||||
return 1;
|
||||
}
|
||||
// Initialize wins struct if used
|
||||
|
|
|
|||
2
makefile
2
makefile
|
|
@ -7,7 +7,7 @@ ARCH = native
|
|||
O = s
|
||||
|
||||
# Flags for the compiler
|
||||
FLAGS = -std=gnu99
|
||||
FLAGS = -std=c99
|
||||
FLAGS += -O$(O)
|
||||
FLAGS += -march=$(ARCH)
|
||||
# Only override gcc default tuning if specified in make command line
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue