diff --git a/src/c2.c b/src/c2.c
index 45b5368..567c655 100644
--- a/src/c2.c
+++ b/src/c2.c
@@ -31,6 +31,7 @@
#include "win.h"
#include "c2.h"
#include "string_utils.h"
+#include "log.h"
#define C2_MAX_LEVELS 10
diff --git a/src/common.h b/src/common.h
index d606eaf..83e1233 100644
--- a/src/common.h
+++ b/src/common.h
@@ -141,6 +141,7 @@
#include "win.h"
#include "x.h"
#include "region.h"
+#include "log.h"
// === Constants ===
diff --git a/src/compton.c b/src/compton.c
index 187e7d0..d702b95 100644
--- a/src/compton.c
+++ b/src/compton.c
@@ -30,6 +30,7 @@
#include "config.h"
#include "diagnostic.h"
#include "string_utils.h"
+#include "log.h"
#define auto __auto_type
diff --git a/src/compton.h b/src/compton.h
index 951d171..62e68d4 100644
--- a/src/compton.h
+++ b/src/compton.h
@@ -33,6 +33,7 @@
#include "win.h"
#include "x.h"
#include "c2.h"
+#include "log.h" // XXX clean up
// == Functions ==
// TODO move static inline functions that are only used in compton.c, into
diff --git a/src/config.c b/src/config.c
index 5f86b1e..e64180b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -9,6 +9,7 @@
#include "utils.h"
#include "c2.h"
#include "string_utils.h"
+#include "log.h"
#include "config.h"
diff --git a/src/config_libconfig.c b/src/config_libconfig.c
index 32d483b..ee9a430 100644
--- a/src/config_libconfig.c
+++ b/src/config_libconfig.c
@@ -11,6 +11,7 @@
#include "common.h"
#include "config.h"
#include "string_utils.h"
+#include "log.h"
/**
* Wrapper of libconfig's config_lookup_int
.
diff --git a/src/dbus.c b/src/dbus.c
index 024df78..b1085dc 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -11,6 +11,7 @@
#include "win.h"
#include "string_utils.h"
+#include "log.h"
#include "dbus.h"
diff --git a/src/opengl.c b/src/opengl.c
index 5e19435..664da29 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -10,6 +10,8 @@
*/
#include "string_utils.h"
+#include "log.h"
+
#include "opengl.h"
static inline int
diff --git a/src/opengl.h b/src/opengl.h
index 69b8816..326b5e8 100644
--- a/src/opengl.h
+++ b/src/opengl.h
@@ -12,6 +12,7 @@
#pragma once
#include "common.h"
+#include "log.h"
#include
#include
diff --git a/src/region.h b/src/region.h
index a42f9f2..3627651 100644
--- a/src/region.h
+++ b/src/region.h
@@ -43,7 +43,7 @@ from_x_rect(const xcb_rectangle_t *rect) {
/// Returning an array that needs to be freed
static inline rect_t *
from_x_rects(int nrects, const xcb_rectangle_t *rects) {
- rect_t *ret = calloc(nrects, sizeof *ret);
+ rect_t *ret = ccalloc(nrects, rect_t);
for (int i = 0; i < nrects; i++)
ret[i] = from_x_rect(rects+i);
return ret;
diff --git a/src/utils.h b/src/utils.h
index 5bede5a..15ee5ed 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -10,8 +10,6 @@
#include
#include
-#include "log.h"
-
#define ARR_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
#ifdef __FAST_MATH__
diff --git a/src/win.c b/src/win.c
index a1ba8c0..a019df1 100644
--- a/src/win.c
+++ b/src/win.c
@@ -13,6 +13,7 @@
#include "c2.h"
#include "x.h"
#include "string_utils.h"
+#include "log.h"
#include "win.h"
diff --git a/src/win.h b/src/win.h
index ff65b17..75a205b 100644
--- a/src/win.h
+++ b/src/win.h
@@ -16,7 +16,6 @@
#include "x.h"
#include "types.h"
#include "c2.h"
-#include "utils.h"
typedef struct session session_t;
typedef struct _glx_texture glx_texture_t;
diff --git a/src/x.c b/src/x.c
index 9c097af..157bc21 100644
--- a/src/x.c
+++ b/src/x.c
@@ -10,6 +10,7 @@
#include "common.h"
#include "x.h"
+#include "log.h"
/**
* Get a specific attribute of a window.
diff --git a/src/xrescheck.c b/src/xrescheck.c
index 1cd25ee..5a5ec6b 100644
--- a/src/xrescheck.c
+++ b/src/xrescheck.c
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2014 Richard Grenville
+#include "log.h"
+
#include "xrescheck.h"
static xrc_xid_record_t *gs_xid_records = NULL;