diff --git a/inc/lektor/common.h b/inc/lektor/common.h
index 343582eef506caab4ec8950565bc53c4c559ea8a..ee8b21e072e493e137e06864f4fbce2c2b7a1e50 100644
--- a/inc/lektor/common.h
+++ b/inc/lektor/common.h
@@ -13,8 +13,8 @@ extern "C" {
 #include <stdnoreturn.h>
 #include <stdarg.h>
 
-#define NOT_IMPLEMENTED __not_implemented(__func__, __FILE__, __LINE__)
-extern EXIT_FUNCTION __not_implemented(const char *func, char *file, int line);
+#define NOT_IMPLEMENTED ___not_implemented(__func__, __FILE__, __LINE__)
+extern EXIT_FUNCTION ___not_implemented(const char *func, char *file, int line);
 
 /* TODO macro, use like:
  * #pragma message(TODO "What to do")*/
@@ -74,45 +74,45 @@ extern EXIT_FUNCTION __not_implemented(const char *func, char *file, int line);
 #define FOR_EVER_UNTIL(expr) FOR_EVER_IF(!(expr))
 
 /* Custom defined assert. */
-extern void (*__lkt_assert)(const char *file, int line, const char *func, const char *msg);
+extern void (*___lkt_assert)(const char *file, int line, const char *func, const char *msg);
 #ifdef assert
 #undef assert
 #endif
 #ifdef NDEBUG
 #define assert(ex)
 #else
-#define assert(ex) (void)((ex) || (__lkt_assert(__FILE__, __LINE__, __func__, #ex), 0))
+#define assert(ex) (void)((ex) || (___lkt_assert(__FILE__, __LINE__, __func__, #ex), 0))
 #endif
 
 /* Custom defined abort. */
-extern EXIT_FUNCTION __lkt_abort(void);
+extern EXIT_FUNCTION ___lkt_abort(void);
 #ifdef abort
 #undef abort
 #endif
-#define abort() __lkt_abort()
+#define abort() ___lkt_abort()
 
 /* Custom log functions. */
-enum log_level {
-    ERROR = 1,
-    WARN  = 2,
-    INFO  = 3,
-    DEBUG = 4,
-    __LAST_UNUSED_LOG_LEVEL, /* Usefull to enable all by default */
-};
-extern enum log_level __log_level;
-void __lkt_log(enum log_level, const char *section, const char *func, const char *file, uint64_t line,
-               const char *format, ...);
-#define LOG_DEBUG(sec, ...) __lkt_log(DEBUG, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
-#define LOG_INFO(sec, ...)  __lkt_log(INFO, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
-#define LOG_WARN(sec, ...)  __lkt_log(WARN, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
-#define LOG_ERROR(sec, ...) __lkt_log(ERROR, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
+typedef enum {
+    LOG_LEVEL_ERROR = 1,
+    LOG_LEVEL_WARN  = 2,
+    LOG_LEVEL_INFO  = 3,
+    LOG_LEVEL_DEBUG = 4,
+    ___LAST_UNUSED_LOG_LEVEL, /* Usefull to enable all by default */
+} LOG_LEVEL;
+extern LOG_LEVEL ___log_level;
+void ___lkt_log(LOG_LEVEL, const char *section, const char *func, const char *file, uint64_t line,
+                const char *format, ...);
+#define LOG_DEBUG(sec, ...) ___lkt_log(LOG_LEVEL_DEBUG, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
+#define LOG_INFO(sec, ...)  ___lkt_log(LOG_LEVEL_INFO, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
+#define LOG_WARN(sec, ...)  ___lkt_log(LOG_LEVEL_WARN, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
+#define LOG_ERROR(sec, ...) ___lkt_log(LOG_LEVEL_ERROR, sec, __func__, __FILE__, __LINE__, __VA_ARGS__)
 #define LOG_FATAL(...)                                                                                                 \
     {                                                                                                                  \
         LOG_ERROR("FATAL", __VA_ARGS__);                                                                               \
         exit(1);                                                                                                       \
     }
-void __lkt_print(const char *section, const char *format, ...);
-#define LKT_OUTPUT(section, ...) __lkt_print(section, __VA_ARGS__)
+void ___lkt_print(const char *section, const char *format, ...);
+#define LKT_OUTPUT(section, ...) ___lkt_print(section, __VA_ARGS__)
 
 #define LKT_ENV_RESTART    "__LKT_RESTART"
 #define LKT_ENV_CURRENT    "__LKT_CURRENT"
@@ -161,7 +161,7 @@ typedef volatile enum {
     MPD_IDLE_ALL = MPD_IDLE_DATABASE | MPD_IDLE_UPDATE | MPD_IDLE_STORED_PLAYLIST | MPD_IDLE_PLAYLIST |
                    MPD_IDLE_PLAYER | MPD_IDLE_MIXER | MPD_IDLE_OUTPUT | MPD_IDLE_OPTIONS | MPD_IDLE_PARTITION |
                    MPD_IDLE_STICKER | MPD_IDLE_SUBSCRIPTION | MPD_IDLE_MESSAGE,
-} mpd_idle_flag;
+} MPD_IDLE_FLAG;
 
 #define STR_MATCH(str1, str2)     (!strcasecmp(str1, str2))
 #define STR_NMATCH(str1, str2, n) (!strncasecmp(str1, str2, n))
diff --git a/inc/lektor/net.h b/inc/lektor/net.h
index 1a2ef7b56998007c360ea486b7f9f51468ec89cc..a9c5f04154d0fa690b61a6edcf5da1bfb42164d4 100644
--- a/inc/lektor/net.h
+++ b/inc/lektor/net.h
@@ -68,7 +68,7 @@ struct lkt_state {
     uint8_t is_updating;
 
     /* Internal event flags */
-    mpd_idle_flag mpd_idle_events;
+    MPD_IDLE_FLAG mpd_idle_events;
     pthread_mutex_t lock;
 
     /* Modules */
@@ -99,7 +99,7 @@ void lkt_set_continuation(struct lkt_state *srv, size_t c, int i);
 /* Get the mask to watch for events for a given client, to be used with the `idle` command.
  * Return a pointer to the client's mask */
 int lkt_client_get_mask(struct lkt_state *srv, size_t c);
-void lkt_client_add_mask(struct lkt_state *srv, size_t c, mpd_idle_flag add);
+void lkt_client_add_mask(struct lkt_state *srv, size_t c, MPD_IDLE_FLAG add);
 void lkt_client_clear_mask(struct lkt_state *srv, size_t c);
 
 /* Register a client as authentificated. */
diff --git a/src/base/common.c b/src/base/common.c
index f1edcd3b03f06be142022bce739f0ee8fca087ff..fb60ffd0bbaaa42681608f3fd6dee6a8444d0cfb 100644
--- a/src/base/common.c
+++ b/src/base/common.c
@@ -14,7 +14,7 @@
 /* Abort function */
 
 EXIT_FUNCTION
-__lkt_abort(void)
+___lkt_abort(void)
 {
     LOG_ERROR("ABORT", "Got aborted, I will provoque a segv to try to display the backtrace...");
     int *segv = (int *)-1;
@@ -25,19 +25,19 @@ __lkt_abort(void)
 /* Assert function */
 
 static void
-__no_assert(const char UNUSED *f, int UNUSED l, const char UNUSED *fn, const char UNUSED *m)
+___no_assert(const char UNUSED *f, int UNUSED l, const char UNUSED *fn, const char UNUSED *m)
 {
 }
 
 EXIT_FUNCTION
-__yes_assert(const char *file, int line, const char *func, const char *msg)
+___yes_assert(const char *file, int line, const char *func, const char *msg)
 {
     LOG_ERROR("ASSERT", "Assertion failed: %s:%s:%d: %s", file, func, line, msg);
     LOG_ERROR("ASSERT", "I will provoque a segv to try to display the backtrace...");
-    __lkt_abort();
+    ___lkt_abort();
 }
 
-void (*__lkt_assert)(const char *file, int line, const char *func, const char *msg) = __no_assert;
+void (*___lkt_assert)(const char *file, int line, const char *func, const char *msg) = ___no_assert;
 
 CONSTRUCTOR_FUNCTION
 __set_assert(void)
@@ -45,18 +45,20 @@ __set_assert(void)
 #ifndef NDEBUG
     const char *yes_assert = getenv(LKT_ENV_SET_ASSERT);
     if (NULL != yes_assert && strlen(yes_assert) > 0)
-        __lkt_assert = __yes_assert;
+        ___lkt_assert = ___yes_assert;
 #endif
 }
 
 /* Log functions */
 
-enum log_level __log_level = __LAST_UNUSED_LOG_LEVEL; /* All by default */
+LOG_LEVEL ___log_level = ___LAST_UNUSED_LOG_LEVEL; /* All by default */
 
 void
-__lkt_log(enum log_level level, const char *section, const char *func, const char *file, uint64_t line_number,
-          const char *format, ...)
+___lkt_log(LOG_LEVEL level, const char *section, const char *func, const char *file, uint64_t line_number,
+           const char *format, ...)
 {
+    assert(level != ___LAST_UNUSED_LOG_LEVEL);
+
     char line[LKT_MESSAGE_MAX];
     va_list ap;
     int hour = 0, min = 0, sec = 0;
@@ -74,10 +76,10 @@ __lkt_log(enum log_level level, const char *section, const char *func, const cha
         skip_dir = strcspn(file, "/");
     } while (file[skip_dir] && file[skip_dir + 1]);
 
-    if (level > __log_level)
+    if (level > ___log_level)
         return;
 
-    char c_level  = level == ERROR ? '!' : level == WARN ? '*' : level == INFO ? '.' : ' ';
+    char c_level = level == LOG_LEVEL_ERROR ? '!' : level == LOG_LEVEL_WARN ? '*' : level == LOG_LEVEL_INFO ? '.' : ' ';
     ssize_t count = safe_snprintf(line, LKT_MESSAGE_MAX, " %c [%02d:%02d:%02d] %-10s %s(%s+%ld): %s\n", c_level, hour,
                                   min, sec, section, func, file, line_number, format);
     /* Check for overflow */
@@ -95,7 +97,7 @@ __lkt_log(enum log_level level, const char *section, const char *func, const cha
 }
 
 void
-__lkt_print(const char *section, const char *format, ...)
+___lkt_print(const char *section, const char *format, ...)
 {
     char line[LKT_MESSAGE_MAX];
     va_list ap;
@@ -127,10 +129,10 @@ __lkt_print(const char *section, const char *format, ...)
 /* Not implemented */
 
 EXIT_FUNCTION
-__not_implemented(const char *func, char *file, int line)
+___not_implemented(const char *func, char *file, int line)
 {
     LOG_ERROR("GENERAL", "Function %s in file %s at line %d not implemented", func, file, line);
-    __lkt_abort();
+    ___lkt_abort();
 }
 
 char *
diff --git a/src/base/config.c b/src/base/config.c
index d45acc8c28a1dada426d836fdefff0f28ad13194..fe0dc851acdf808ab11080151dca626a1568ba5c 100644
--- a/src/base/config.c
+++ b/src/base/config.c
@@ -58,17 +58,17 @@ __set_log_level(const char *name, const char *level)
     }
 
     if (STR_MATCH(level, "error"))
-        __log_level = ERROR;
+        ___log_level = LOG_LEVEL_ERROR;
     else if (STR_MATCH(level, "warn") || STR_MATCH(level, "warning"))
-        __log_level = WARN;
+        ___log_level = LOG_LEVEL_WARN;
     else if (STR_MATCH(level, "info"))
-        __log_level = INFO;
+        ___log_level = LOG_LEVEL_INFO;
     else if (STR_MATCH(level, "debug"))
-        __log_level = DEBUG;
+        ___log_level = LOG_LEVEL_DEBUG;
     else
-        __log_level = strtol(level, NULL, 0);
+        ___log_level = strtol(level, NULL, 0);
 
-    LOG_INFO("CONFIG", "Log level set to %d", __log_level);
+    LOG_INFO("CONFIG", "Log level set to %d", ___log_level);
 }
 
 static inline int
diff --git a/src/main/lkt.c b/src/main/lkt.c
index 0a7cad2ab9505b4b8e4cd605c6b1e2c6b9645e25..00c98e3ad8329bd872d44a2fcb4a7efc377090f2 100644
--- a/src/main/lkt.c
+++ b/src/main/lkt.c
@@ -1337,7 +1337,7 @@ main(int argc, const char **argv)
 {
     __install_segv_handler_verbose = 0;
     install_segv_handler();
-    __log_level     = ERROR;
+    ___log_level    = LOG_LEVEL_ERROR;
     executable_name = "lkt";
     assert(NULL != setlocale(LC_ALL, "en_US.UTF-8")); /* BECAUSE! */
     if (signal(SIGPIPE, sigpipe__))
diff --git a/src/main/luka.c b/src/main/luka.c
index 54948e88cc4ef36ab90d006a88692685af3362ad..b15c0fd2ea6c636fab65b3f875cb4dcd62fbc9ff 100644
--- a/src/main/luka.c
+++ b/src/main/luka.c
@@ -446,7 +446,7 @@ __SUB_COMMAND(admin)
 int
 main(const int argc, const char **argv)
 {
-    __log_level                    = ERROR;
+    ___log_level                   = LOG_LEVEL_ERROR;
     executable_name                = "luka";
     __install_segv_handler_verbose = 0;
     install_segv_handler();
diff --git a/src/net/listen.c b/src/net/listen.c
index 24d629fb2df0584d9e9671e5b017c01da7e0eb72..34a0f0a3d2060d7a67094f03e10caf92e8a50388 100644
--- a/src/net/listen.c
+++ b/src/net/listen.c
@@ -46,7 +46,7 @@ struct lkt_client {
     size_t command_list_len;
     enum lkt_command_list_mode command_list_mode;
 
-    mpd_idle_flag mpd_idle_watch;
+    MPD_IDLE_FLAG mpd_idle_watch;
     bool request_close;
 
     bool authentificated;
@@ -701,7 +701,7 @@ static int
 handle_idle_events(struct lkt_state *srv)
 {
     struct lkt_client *current_client;
-    mpd_idle_flag common_mask;
+    MPD_IDLE_FLAG common_mask;
     char msg_data[LKT_MESSAGE_MAX];
     bool once = false;
 
@@ -772,7 +772,7 @@ lkt_client_get_mask(struct lkt_state *srv, size_t c)
 }
 
 void
-lkt_client_add_mask(struct lkt_state *srv, size_t c, mpd_idle_flag add)
+lkt_client_add_mask(struct lkt_state *srv, size_t c, MPD_IDLE_FLAG add)
 {
     if (pthread_mutex_lock(&srv->lock))
         return;