diff options
Diffstat (limited to 'domino.c')
| -rw-r--r-- | domino.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/domino.c b/domino.c new file mode 100644 index 0000000..cdaa52d --- /dev/null +++ b/domino.c @@ -0,0 +1,12 @@ +#include <stdlib.h> +#include "domino.h" + +void bricks_append(struct bricks *bricks, struct brick brick) { + if (bricks->count+1 > bricks->capacity) { + if (bricks->capacity == 0) bricks->capacity = 256; + while (bricks->count+1 > bricks->capacity) bricks->capacity *= 2; + bricks->items.brick = realloc(bricks->items.brick, bricks->capacity * sizeof(*bricks->items.brick)); + } + bricks->items.brick[bricks->count++] = brick; +} + |
