bunkum

an old and silly c99 web server with some fun features
Log | Files | Refs | README

commit 11a6e4ad93d37e2479f40dddb54237b6c016d89c
parent f4fa844cfcb9703fbe0c11e4167f192169ddbae7
Author: quantumish <freifeld.david@gmail.com>
Date:   Sun,  9 Apr 2023 02:21:25 -0700

Fix bugs in logging, shitvec

Diffstat:
Mhttp.c | 2+-
Mutils/log.c | 2+-
Mutils/shitvec.c | 2+-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/http.c b/http.c @@ -126,7 +126,7 @@ void* handle_conn(void* ctxt) { int main() { int s = socket(AF_INET, SOCK_STREAM, 0); if (s == -1) die("socket"); - + struct sockaddr_in name; name.sin_family = AF_INET; name.sin_port = htons(8082); diff --git a/utils/log.c b/utils/log.c @@ -18,7 +18,7 @@ #define ANSI_MAGENTA "\x1b[36m" #define ANSI_RESET "\x1b[0m" -const char* lvl_colors = +const char* lvl_colors[] = {ANSI_MAGENTA, ANSI_GREEN, ANSI_CYAN, ANSI_YELLOW, ANSI_RED, ANSI_BOLDRED}; size_t log_min_level = 0; diff --git a/utils/shitvec.c b/utils/shitvec.c @@ -20,11 +20,11 @@ void* shitvec_get(shitvec_t* sv, size_t index) { } void shitvec_push(shitvec_t* sv, void* item) { - sv->vec_sz += 1; if ((sv->arr+(sv->e_sz * sv->vec_sz)) > sv->arr+sv->alloc_sz) { sv->arr = realloc(sv->arr, sv->alloc_sz * 2); } memcpy(sv->arr+(sv->vec_sz * sv->e_sz), item, sv->e_sz); + sv->vec_sz += 1; }