diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d7cf3dda..ec512ea35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ configure_file(${CMAKE_MODULE_PATH}/build.h.in ${CMAKE_BINARY_DIR}/build.h) set(conky_sources ${CMAKE_BINARY_DIR}/config.h ${CMAKE_BINARY_DIR}/build.h) # Finally, add some code +add_subdirectory(lua) add_subdirectory(data) add_subdirectory(doc) @@ -67,8 +68,6 @@ endif() add_subdirectory(src) -add_subdirectory(lua) - if(BUILD_TESTS) add_subdirectory(tests) enable_testing() diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index 6dbaa1bca..0619ca278 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -72,7 +72,7 @@ if(BUILD_LUA_IMLIB2) add_library(conky-imlib2 MODULE ${luaimlib2_src}) set_target_properties(conky-imlib2 PROPERTIES OUTPUT_NAME "imlib2") - target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static ) + target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static) set(lua_libs ${lua_libs} conky-imlib2) print_target_properties(conky-imlib2) diff --git a/src/darwin.mm b/src/darwin.mm index 448816ca2..52611decc 100644 --- a/src/darwin.mm +++ b/src/darwin.mm @@ -87,11 +87,8 @@ #include #endif -/* debugging defines */ -#undef NDEBUG - /* (E)nhanced printf */ -#ifndef NDEBUG +#if true // ifdef NDEBUG #include void eprintf(const char *fmt, ...) { va_list args; diff --git a/src/logging.h b/src/logging.h index 6ae76c841..e59cb4534 100644 --- a/src/logging.h +++ b/src/logging.h @@ -92,9 +92,9 @@ namespace _priv_error_print { template inline std::string alloc_printf(const char *format, Args &&...args) { auto size = std::snprintf(nullptr, 0, format, args...); - std::string output(size + 1, '\0'); - std::sprintf(&output[0], format, args...); - return output; + char output[size + 1]; + std::snprintf(output, sizeof(output), format, args...); + return std::string(&output[0]); } inline std::string alloc_printf(const char *format) { return std::string(format); @@ -103,6 +103,10 @@ inline std::string alloc_printf(const char *format) { class error : public std::runtime_error { public: + /// @brief Construct a new error object. + /// + /// @param Msg Already localized error message. + error(const std::string &msg) : std::runtime_error(msg) {} error(const char *msg) : std::runtime_error(_(msg)) {} template error(const char *format, Args &&...args)