Skip to content

Commit

Permalink
try assert size
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGAzed committed Jun 23, 2024
1 parent 3fd66c2 commit 2a6a216
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions program/source/structures/concrete/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ KGrid _init_grid(FILE * kakuro_file) {
KGrid g = { 0 };
assert(fread(&(g.size[ROW]), sizeof(ksize_t), 1, kakuro_file));
assert(fread(&(g.size[COLUMN]), sizeof(ksize_t), 1, kakuro_file));
if (ferror(kakuro_file)) {
perror("Error during fread");
}

assert(g.size[ROW] && "ROW COUNT IS ZERO");
assert(g.size[COLUMN] && "COLUMN COUNT IS ZERO");
g.count = g.size[ROW] * g.size[COLUMN];

assert((g.grids[ROW] = malloc(g.size[ROW] * sizeof(lookup_t*))) && "ALLOCATION TO ROW ARRAY FAILED");
Expand Down

0 comments on commit 2a6a216

Please sign in to comment.