don't even think about looking at this miserable commit

This commit is contained in:
malloc 2019-02-26 10:26:54 -06:00
parent 7fccb45259
commit 20ec87f505
4 changed files with 10 additions and 4 deletions

View file

@ -19,7 +19,7 @@ install(TARGETS server RUNTIME DESTINATION bin/server)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(server wsock32 ws2_32) target_link_libraries(server wsock32 ws2_32)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(server pthread nsl resolv) target_link_libraries(server dl pthread nsl resolv)
else() else()
target_link_libraries(server pthread socket nsl resolv) target_link_libraries(server dl pthread socket nsl resolv)
endif() endif()

View file

@ -1,7 +1,12 @@
#include <stdio.h> #include <stdio.h>
#include "util/ipaddr.h" #include "util/ipaddr.h"
#include "util/containers.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
glv_map_t* map = glv_map_create();
glv_map_set_copy(map, "test", "Hello!", 0);
glv_map_set_copy(map, "amazing", "Hello!!", 0);
glv_map_set_copy(map, "holy me WOW", "Hello!!", 0);
return 0; return 0;
} }

View file

@ -9,7 +9,7 @@ struct {
} _ssl_ctx; } _ssl_ctx;
static int ssl_init() { static int ssl_init() {
static int is_inited = 0; /*static int is_inited = 0;
if(is_inited) if(is_inited)
return 1; return 1;
@ -31,5 +31,5 @@ static int ssl_init() {
success |= SSL_CTX_use_certificate_file( success |= SSL_CTX_use_certificate_file(
_ssl_ctx.server, _ssl_ctx.server,
); );*/
} }

View file

@ -89,6 +89,7 @@ void* glv_map_set(glv_map_t* map, const char* key, void* value) {
void* glv_map_set_copy void* glv_map_set_copy
(glv_map_t* map, const char* key, void* value, size_t length) (glv_map_t* map, const char* key, void* value, size_t length)
{ {
length = (length == 0 ? strlen(value) + 1 : length);
void* copy = malloc(length); void* copy = malloc(length);
memcpy(copy, value, length); memcpy(copy, value, length);