aoc-2019-c

git clone https://git.sinitax.com/sinitax/aoc-2019-c
Log | Files | Refs | README | sfeed.txt

commit 7a1d03885ad1781ee45b4cad37a8124e8958cf6c
parent 657f00f7306825c6f5f5554aab842af3ae72b9eb
Author: Louis Burda <quent.burda@gmail.com>
Date:   Fri, 17 Mar 2023 21:35:14 +0100

Fixup day 8

Diffstat:
D08/Makefile | 12------------
A08/info.mk | 2++
M08/main.c | 14+++++++++-----
3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/08/Makefile b/08/Makefile @@ -1,12 +0,0 @@ -CFLAGS = -g -I ../../libs/include -L ../../libs/build -LDLIBS = -laoc - -all: lib main - -clean: - rm main - -lib: - make -C ../../libs - -main: main.c ../../libs/build/libaoc.a diff --git a/08/info.mk b/08/info.mk @@ -0,0 +1,2 @@ +08_SRC = 08/main.c common/main.c common/aoc.c common/util.c +08_HDR = common/aoc.h common/util.h diff --git a/08/main.c b/08/main.c @@ -1,8 +1,10 @@ #include "aoc.h" +#include "util.h" -#include <stdlib.h> +#include <assert.h> #include <stdio.h> #include <string.h> +#include <stdlib.h> const int width = 25; const int height = 6; @@ -35,9 +37,10 @@ part1(void) i += k; } - ASSERT(minz != -1); + assert(minz != -1); - aoc.answer = CHKP(aprintf("%i", res)); + aoc.answer = aprintf("%i", res); + aoc.solution = "2016"; } void @@ -57,10 +60,11 @@ part2(void) } } - str = CHKP(malloc((width + 1) * height + 1)); + str = malloc((width + 1) * height + 1); + assert(str != NULL); for (i = 0; i < height; i++) { for (k = 0; k < width; k++) { - ASSERT(img[i * width + k] != 2); + assert(img[i * width + k] != 2); str[i * (width + 1) + k] = img[i * width + k] ? '#' : ' '; } str[i * (width + 1) + k] = '\n';