fix indentation

This commit is contained in:
Evan Burkey 2022-12-07 14:59:51 +01:00
parent bb8dbf7b5c
commit f707e08fa1
24 changed files with 77 additions and 75 deletions

View File

@ -6,8 +6,8 @@
#include "lfinput.h" #include "lfinput.h"
#include "lflinkedlist.h" #include "lflinkedlist.h"
static int cmp(const void* a, const void* b) { static int cmp(const void *a, const void *b) {
return (*(int*)a - *(int*)b); return (*(int *) a - *(int *) b);
} }
void advent2022day01(void) { void advent2022day01(void) {
@ -15,24 +15,24 @@ void advent2022day01(void) {
const char *errstr; const char *errstr;
int t = 0; int t = 0;
List* totals = malloc(sizeof(List)); List *totals = malloc(sizeof(List));
ll_init(totals, free); ll_init(totals, free);
while ((found = strsep(&input, "\n")) != NULL) { while ((found = strsep(&input, "\n")) != NULL) {
if (strcmp(found, "") == 0) { if (strcmp(found, "") == 0) {
int *i = malloc(sizeof(int)); int *i = malloc(sizeof(int));
*i = t; *i = t;
ll_ins_next(totals, totals->tail, (void*)i); ll_ins_next(totals, totals->tail, (void *) i);
t = 0; t = 0;
} else { } else {
t += (int)(strtonum(found, 0, INT_MAX, &errstr)); t += (int) (strtonum(found, 0, INT_MAX, &errstr));
} }
} }
int elves[totals->size]; int elves[totals->size];
int i = 0; int i = 0;
LL_ITER(totals) { LL_ITER(totals) {
elves[i++] = *(int*)(node->data); elves[i++] = *(int *) (node->data);
} }
qsort(elves, totals->size, sizeof(int), cmp); qsort(elves, totals->size, sizeof(int), cmp);

View File

@ -4,7 +4,9 @@
#include "lfinput.h" #include "lfinput.h"
void advent2022day03(void) { void advent2022day03(void) {
char *input = get_input("input/2022/03"); size_t sz = 0;
printf("Solution for Day 03 of 2022 is not completed yet\n"); char **input = get_lines("input/2022/03", &sz);
free(input);
del_lines(input);
} }