From 01c3959cbb6dbe378c7ec6d5d079397fdc1296b7 Mon Sep 17 00:00:00 2001 From: amy Date: Tue, 11 Nov 2025 19:32:32 -0600 Subject: oops fix null dereference and stuff --- src/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index 5612638..3baabe6 100644 --- a/src/util.c +++ b/src/util.c @@ -13,8 +13,10 @@ int gen_parse(char* inp, int len, parray_t** _table){ for(int i = 0; i < len; i++){ if(state != 1 && inp[i] == ';'){ - parray_set(table, last->c, (void*)current); - str_free(last); + if(last != NULL){ + parray_set(table, last->c, (void*)current); + str_free(last); + } last = NULL; current = str_init(""); state = 0; @@ -67,3 +69,4 @@ void _p_fatal(const char* m, int line, const char* file, const char* function){ void p_error(const char* m){ fprintf(stderr, "%s[error]%s %s\n",color_red, color_reset, m); } + -- cgit v1.2.3 From c138da8d7f550ef1699eb50d786925d74c18a79a Mon Sep 17 00:00:00 2001 From: basicallygit <91993321+basicallygit@users.noreply.github.com> Date: Thu, 20 Nov 2025 21:33:53 +0000 Subject: Fix returning void value from void functions and print mimetypes warning to stderr --- src/net/util.c | 5 ++++- src/types/str.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/net/util.c b/src/net/util.c index 344ea35..3b820c9 100644 --- a/src/net/util.c +++ b/src/net/util.c @@ -413,7 +413,10 @@ void parse_mimetypes(){ mime_type = map_init(); FILE* fp = fopen(_mimetypes, "r"); - if(fp == NULL) return (void)printf("unable to load mimetypes, set llby.net.mimetypes to a proper location, or nil to skip this\n"); + if(fp == NULL){ + fprintf(stderr, "unable to load mimetypes, set llby.net.mimetypes to a proper location, or nil to skip this\n"); + return; + } char* line = NULL; size_t len = 0; diff --git a/src/types/str.c b/src/types/str.c index e1818a2..bbd5ad9 100644 --- a/src/types/str.c +++ b/src/types/str.c @@ -35,7 +35,7 @@ str* str_init(const char* init){ void str_free(str* s){ free(s->c); - return free(s); + free(s); } void str_push(str* s, const char* insert){ -- cgit v1.2.3 From 8b007445198e9d25b6283ded647586d0e0486220 Mon Sep 17 00:00:00 2001 From: basicallygit <91993321+basicallygit@users.noreply.github.com> Date: Thu, 20 Nov 2025 22:03:32 +0000 Subject: oh ya also mark make options as PHONY --- makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/makefile b/makefile index 2e82331..2dcdf4c 100644 --- a/makefile +++ b/makefile @@ -28,11 +28,13 @@ else CFLAGS += -fPIC endif +.PHONY: all all: $(TARGET) release: CFLAGS += -O3 release: all +.PHONY: install install:: mkdir $(INSTALL)$(install_version) -p cp $(TARGET) $(INSTALL)$(install_version)/$(TARGET) @@ -68,5 +70,8 @@ reg: all $(TARGET): $(OBJS) $(LINKER) $(OBJS) -o $(TARGET) $(LFLAGS) +.PHONY: clean clean: rm -f $(OBJS) + + -- cgit v1.2.3