Skip to content

Commit

Permalink
Merge branch 'main' into lua-as-cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
brndnmtthws committed Feb 23, 2024
2 parents 5733c3e + 3bb8188 commit 9ce0c06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
11 changes: 9 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
stdenv.mkDerivation rec {
name = "conky";
src = ./.;
cmakeFlags = [
"-DBUILD_LUA_CAIRO=ON"
"-DBUILD_LUA_IMLIB2=ON"
"-DBUILD_LUA_RSVG=ON"
];
nativeBuildInputs = [
clang_16
cmake
Expand All @@ -62,23 +67,25 @@
];
buildInputs =
[
cairo
freetype
gettext
imlib2
librsvg
llvmPackages_16.libcxx
llvmPackages_16.libcxxabi
lua5_4
ncurses
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libxcb
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXft
xorg.libXinerama
xorg.libXi
xorg.libxcb
xorg.libXinerama
xorg.xcbutilerrors
]
++ lib.optional stdenv.isDarwin darwin.libobjc;
Expand Down
10 changes: 5 additions & 5 deletions src/x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static int x11_error_handler(Display *d, XErrorEvent *err) {
xcb_errors_ctx, err->error_code, &extension);
if (extension != nullptr) {
const std::size_t size = strlen(base_name) + strlen(extension) + 4;
error_name = new char(size);
error_name = new char[size];
snprintf(error_name, size, "%s (%s)", base_name, extension);
name_allocated = true;
} else {
Expand All @@ -259,7 +259,7 @@ static int x11_error_handler(Display *d, XErrorEvent *err) {
xcb_errors_ctx, err->request_code, err->minor_code);
if (minor != nullptr) {
const std::size_t size = strlen(base_name) + strlen(extension) + 4;
code_description = new char(size);
code_description = new char[size];
snprintf(code_description, size, "%s - %s", major, minor);
code_allocated = true;
} else {
Expand All @@ -284,7 +284,7 @@ static int x11_error_handler(Display *d, XErrorEvent *err) {
}
if (code_description == nullptr) {
const std::size_t size = 37;
code_description = new char(size);
code_description = new char[size];
snprintf(code_description, size, "error code: [major: %i, minor: %i]",
err->request_code, err->minor_code);
code_allocated = true;
Expand All @@ -297,8 +297,8 @@ static int x11_error_handler(Display *d, XErrorEvent *err) {
error_name, reinterpret_cast<uint64_t>(err->display),
static_cast<int64_t>(err->resourceid), err->serial, code_description);

if (name_allocated) free(error_name);
if (code_allocated) free(code_description);
if (name_allocated) delete[] error_name;
if (code_allocated) delete[] code_description;

return 0;
}
Expand Down

0 comments on commit 9ce0c06

Please sign in to comment.