Remove the c99 for loops, just for gcc users. Optional CC var set in makefile

This commit is contained in:
Tiehuis 2015-02-22 16:38:53 +13:00
parent 5d6c3f92be
commit 53e941bf98
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
CC := clang CC ?= clang
CFLAGS += -g -Wall -Wextra CFLAGS += -g -Wall -Wextra
LFLAGS += LFLAGS +=
DEFINES := -DVT100 $(shell pkg-config --cflags sdl2) DEFINES := -DVT100 $(shell pkg-config --cflags sdl2)

View File

@ -154,9 +154,10 @@ int gamestate_end_condition(struct gamestate *g)
{ {
int ret = -1; int ret = -1;
//size_t blocks_counted = 0; //size_t blocks_counted = 0;
int x, y;
for (int x = 0; x < g->opts->grid_width; ++x) { for (x = 0; x < g->opts->grid_width; ++x) {
for (int y = 0; y < g->opts->grid_height; ++y) { for (y = 0; y < g->opts->grid_height; ++y) {
if (g->grid[x][y] >= g->opts->goal) if (g->grid[x][y] >= g->opts->goal)
return 1; return 1;
if (!g->grid[x][y] || ((x + 1 < g->opts->grid_width) && if (!g->grid[x][y] || ((x + 1 < g->opts->grid_width) &&
@ -238,8 +239,9 @@ struct gamestate* gamestate_init(struct gameoptions *opt)
if (!g->grid) goto grid_alloc_fail; if (!g->grid) goto grid_alloc_fail;
/* Switch to two allocation version */ /* Switch to two allocation version */
int i;
long **iterator = g->grid; long **iterator = g->grid;
for (int i = 0; i < g->gridsize; i += opt->grid_width) for (i = 0; i < g->gridsize; i += opt->grid_width)
*iterator++ = &g->grid_data_ptr[i]; *iterator++ = &g->grid_data_ptr[i];
g->moved = 0; g->moved = 0;