Index: aoc2024.c ================================================================== --- aoc2024.c +++ aoc2024.c @@ -5,10 +5,15 @@ #include #include #include "aocdailies.h" #include "aocutils.h" +void aoc202404(char *data, size_t len) { + (void)data; // unused argument + (void)len; // unused argument + printf("wip/n"); +} static size_t rcmap(unsigned size, unsigned row, unsigned col) { return row * (size + 1) + col; } static bool masat(char *data, unsigned size, unsigned row, unsigned col, int drow, int dcol) { Index: aocdailies.c ================================================================== --- aocdailies.c +++ aocdailies.c @@ -4,10 +4,11 @@ aocfunc *aocselect(unsigned y, unsigned d) { aocfunc *p; switch (y * 100 + d) { default: p = NULL; break; + case 202405: p = aoc202405; break; case 202404: p = aoc202404; break; case 202403: p = aoc202403; break; case 202402: p = aoc202402; break; case 202401: p = aoc202401; break; Index: aocdailies.h ================================================================== --- aocdailies.h +++ aocdailies.h @@ -4,10 +4,11 @@ #include typedef void aocfunc(char *, size_t); aocfunc *aocselect(unsigned, unsigned); +aocfunc aoc202405; aocfunc aoc202404; aocfunc aoc202403; aocfunc aoc202402; aocfunc aoc202401; Index: aocutils.c ================================================================== --- aocutils.c +++ aocutils.c @@ -7,11 +7,11 @@ size_t na = 0, sa = 512; char *err; unsigned v; for (;;) { if (na == sa) { - // 13/8 is within 0.5% of the golden ratio + // grow the array (by golden ratio) unsigned *tmp = realloc(a, ((13*sa) / 8) * sizeof *tmp); if (!tmp) exit(EXIT_FAILURE); a = tmp; sa = (13*sa) / 8; } @@ -39,12 +39,11 @@ char *tmp = malloc(512); size_t s = 512; size_t r = 0; while ((ch = fgetc(h)) != EOF) { if (r == s) { - //grow tmp - // 13/8 is within 0.5% of the golden ratio + // grow the array (by golden ratio) char *ttmp = realloc(tmp, (13*s) / 8); if (ttmp) { tmp = ttmp; s = (13*s) / 8; } else {