diff --git a/CMakeLists.txt b/CMakeLists.txt index d34c0445..e2ecf112 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,8 +31,14 @@ cmake_minimum_required(VERSION 2.6) project(HOMEPORT C) +set(CMAKE_C_FLAGS "-DHPD_HTTP -DLR_ORIGIN") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DDEBUG -Wall") + # -fPIC is for compiling on 64bit -set(CMAKE_C_FLAGS_DEBUG "-fPIC -g -DDEBUG -DHPD_HTTP -DLR_ORIGIN -Wall") +if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) + set(CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS_DEBUG "-fPIC ${CMAKE_C_FLAGS_DEBUG}") +endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind") include(CTest) diff --git a/OperationHandler/homeport/src/homeport.c b/OperationHandler/homeport/src/homeport.c index a034a0ef..7e03e9e0 100644 --- a/OperationHandler/homeport/src/homeport.c +++ b/OperationHandler/homeport/src/homeport.c @@ -152,7 +152,8 @@ homePortEasy( int (*init)(HomePort *homeport, void *data), void (*deinit)(HomePo ev_signal_start(loop, &sigterm_watcher); // Call init - if ((rc = init(homeport, data))) return rc; + if (init) + if ((rc = init(homeport, data))) return rc; if( ( rc = homePortStart(homeport) ) ) return rc; @@ -452,7 +453,8 @@ sig_cb ( struct ev_loop *loop, struct ev_signal *w, int revents ) // TODO Might be a problem that deinit is not called on ws_stop, but // only if the server is stopped by a signal. Note that this is only // used in HPD_easy way of starting the server. - deinit(homeport, ((void **)w->data)[2]); + if (deinit) + deinit(homeport, ((void **)w->data)[2]); // Stop server and loop diff --git a/misc/src/linkedmap.c b/misc/src/linkedmap.c index 1c4b84e5..7b3a8f21 100644 --- a/misc/src/linkedmap.c +++ b/misc/src/linkedmap.c @@ -165,9 +165,11 @@ char* lm_find_n(struct lm *map, const char* key, size_t key_len) if(map){ for(it = ll_head(map->pairs); it != NULL; it = ll_next(it)) { + if(strlen(((struct pair*)ll_data(it))->key) == key_len){ if(strncmp(((struct pair*)ll_data(it))->key, key, key_len) == 0) { return ((struct pair*)ll_data(it))->value; } + } } } return NULL;