A little refactoring for day 5.

This commit is contained in:
Alexander Andreev 2023-12-07 00:24:03 +04:00
parent 443576621d
commit 83944d8d4c
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 1 additions and 4 deletions

View File

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
int64_t parse_number(char *end); int64_t parse_number(char *end);

View File

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
uint64_t parse_number(char *end); uint64_t parse_number(char *end);
@ -63,8 +62,7 @@ int main(int argc, char **argv) {
} else if (line[0]>>4 != 0x3) } else if (line[0]>>4 != 0x3)
continue; continue;
map_lengths[maps_cur]++; maps[maps_cur] = (map_t *) realloc(maps[maps_cur], ++map_lengths[maps_cur] * sizeof(map_t));
maps[maps_cur] = (map_t *) realloc(maps[maps_cur], map_lengths[maps_cur] * sizeof(map_t));
map_t new_range_map = {0}; map_t new_range_map = {0};
sscanf(line, "%lu %lu %lu\n", &new_range_map.dst, &new_range_map.src, &new_range_map.rng); sscanf(line, "%lu %lu %lu\n", &new_range_map.dst, &new_range_map.src, &new_range_map.rng);