Add uthash to project

This commit is contained in:
Evan Burkey 2021-12-21 07:58:03 -08:00
parent 45b55c05af
commit b86d508820
6 changed files with 24 additions and 6 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "lib/libflint"]
path = lib/libflint
url = https://git.fputs.com/fputs/libflint
[submodule "lib/uthash"]
path = lib/uthash
url = https://github.com/troydhanson/uthash

View File

@ -22,10 +22,10 @@ add_executable(advent ${SRC} ${SRC2015} ${SRC2016} ${SRC2017} ${SRC2018} ${SRC20
if ((${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD"))
target_link_libraries(advent PRIVATE flint)
target_include_directories(advent PRIVATE include lib/libflint/include)
target_include_directories(advent PRIVATE include lib/libflint/include lib/uthash/src)
else()
find_package(OpenSSL REQUIRED)
target_link_libraries(advent PRIVATE bsd flint ${OPENSSL_LIBRARIES})
target_include_directories(advent PRIVATE include lib/libflint/include ${OpenSSL_INCLUDE_DIR})
target_include_directories(advent PRIVATE include lib/libflint/include lib/uthash/src ${OpenSSL_INCLUDE_DIR})
endif()

1
lib/uthash Submodule

@ -0,0 +1 @@
Subproject commit bf15263081be6229be31addd48566df93921cb46

View File

@ -3,7 +3,7 @@
#include <string.h>
#include "lfinput.h"
#include "math.h"
#include "lfmath.h"
void advent2015day02(void) {
size_t sz = 0;

View File

@ -4,7 +4,17 @@
#include "lfinput.h"
void advent2015day07(void) {
char *input = get_input("input/2015/07");
printf("Solution for Day 07 of 2015 is not completed yet\n");
free(input);
size_t sz = 0;
char **input = get_lines("input/2015/07", &sz);
for (size_t i = 0; i < sz; ++i) {
char *buf = malloc(sizeof(char) * 32);
size_t sp_sz = 0;
char **sp = split(buf, &sp_sz, " ");
del_split(sp);
}
del_lines(input);
}

View File

@ -3,6 +3,10 @@
#include <string.h>
#include <limits.h>
#ifdef __linux__
#include <bsd/stdlib.h>
#endif
#include "lfinput.h"
static void solution(long p2) {