From 43c512dc5a7b30d08b6cb8041de7ea0342e1010e Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Mon, 10 May 2021 18:12:08 +0200 Subject: [PATCH] Add gcc opimization --- Makefile | 4 ++-- src/lib/http.h | 4 ++-- src/lib/utils.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7314eaf..b108099 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ compile: compile-debian: @mkdir -p bin gcc $(LIBS) -o bin/libnecronda-server.so --shared -fPIC $(CFLAGS) $(INCLUDE) \ - $(DEBIAN_OPTS) + $(DEBIAN_OPTS) -O3 gcc src/necronda-server.c -o bin/necronda-server $(CFLAGS) $(INCLUDE) \ -Lbin -lnecronda-server -Wl,-rpath=$(shell pwd)/bin \ - $(DEBIAN_OPTS) + $(DEBIAN_OPTS) -O3 diff --git a/src/lib/http.h b/src/lib/http.h index 05188d0..15afc06 100644 --- a/src/lib/http.h +++ b/src/lib/http.h @@ -65,13 +65,13 @@ typedef struct { typedef struct { char method[16]; char *uri; - char version[3]; + char version[4]; http_hdr hdr; } http_req; typedef struct { const http_status *status; - char version[3]; + char version[4]; http_hdr hdr; } http_res; diff --git a/src/lib/utils.c b/src/lib/utils.c index cbb5dcd..4c3acb8 100644 --- a/src/lib/utils.c +++ b/src/lib/utils.c @@ -106,7 +106,7 @@ int url_decode(const char *str, char *dec, long *size) { int mime_is_compressible(const char *type) { if (type == NULL) return 0; char type_parsed[64]; - strncpy(type_parsed, type, sizeof(type_parsed)); + strncpy(type_parsed, type, sizeof(type_parsed) - 1); char *pos = strchr(type_parsed, ';'); if (pos != NULL) pos[0] = 0; return