Skip to content

Commit

Permalink
Fix errors & reduce diff
Browse files Browse the repository at this point in the history
Signed-off-by: Tin Švagelj <[email protected]>
  • Loading branch information
Caellian committed May 4, 2024
1 parent 6f43619 commit 548351b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -67,8 +68,6 @@ endif()

add_subdirectory(src)

add_subdirectory(lua)

if(BUILD_TESTS)
add_subdirectory(tests)
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions src/darwin.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,8 @@
#include <time.h>
#endif

/* debugging defines */
#undef NDEBUG

/* (E)nhanced printf */
#ifndef NDEBUG
#if true // ifdef NDEBUG
#include <cstdarg>
void eprintf(const char *fmt, ...) {
va_list args;
Expand Down
10 changes: 7 additions & 3 deletions src/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ namespace _priv_error_print {
template <typename... Args>
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);
Expand All @@ -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 <typename... Args>
error(const char *format, Args &&...args)
Expand Down

0 comments on commit 548351b

Please sign in to comment.