protomine/src/grid/alloc.c

18 lines
292 B
C

#include "grid.h"
#include <gint/defs/types.h>
#include <gint/std/stdlib.h>
struct Grid
grid_new(int width, int height)
{
struct Grid grid = {width, height, NULL};
grid.data = calloc(width * height, sizeof(uint8_t));
return grid;
}
void
grid_free(struct Grid grid)
{
free(grid.data);
}