diff --git a/src/common/log.c b/src/common/log.c
index f452c7413a83d82f6c04f5e9f030f79b499934a6..bb4b1e12151711d309187c8ccd79e5d35fb099ae 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -29,12 +29,12 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#include "common/compat.h"
 #include "common/util.h"
 #define LOG_PRIVATE
 #include "common/torlog.h"
 #include "lib/container/smartlist.h"
 #include "lib/err/torerr.h"
+#include "lib/malloc/util_malloc.h"
 #include "lib/wallclock/tor_gettimeofday.h"
 #include "lib/wallclock/approx_time.h"
 
diff --git a/src/common/torlog.h b/src/common/torlog.h
index 66141ab0ae611f411a9002f369c6ccedb03deda5..6814cc9d0bbec15ca137e4e0342f3df1ee9d3461 100644
--- a/src/common/torlog.h
+++ b/src/common/torlog.h
@@ -12,7 +12,9 @@
 
 #ifndef TOR_TORLOG_H
 
-#include "common/compat.h"
+#include <stdarg.h>
+#include "lib/cc/torint.h"
+#include "lib/cc/compat_compiler.h"
 #include "lib/testsupport/testsupport.h"
 
 #ifdef HAVE_SYSLOG_H
diff --git a/src/common/util_format.c b/src/common/util_format.c
index 420d8a1a8f1fb9294488a3820dc4be4b8120897b..713e87129c85f1b0dc6b872deb19a490e1d59e42 100644
--- a/src/common/util_format.c
+++ b/src/common/util_format.c
@@ -12,6 +12,7 @@
  */
 
 #include "orconfig.h"
+#include <stddef.h>
 #include "common/torlog.h"
 #include "common/util.h"
 #include "common/util_format.h"
@@ -532,4 +533,3 @@ base16_decode(char *dest, size_t destlen, const char *src, size_t srclen)
 
   return (int) (dest-dest_orig);
 }
-