From 7f3a77ac6a78e82f87b16fae70f1281a707d3e65 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Sat, 17 Apr 2010 17:46:11 +0200
Subject: [PATCH] loglevel bitmasks needs to be larger because we got more than
 32 files

---
 Makefile      | 2 +-
 include/log.h | 2 +-
 src/log.c     | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 93c98e1e..b2b1b036 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ endif
 # Depend on the specific file (.c for each .o) and on all headers
 src/%.o: src/%.c ${HEADERS}
 	echo "CC $<"
-	$(CC) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/$(shell basename $< .c)/ { print NR }' loglevels.tmp))" -c -o $@ $<
+	$(CC) $(CFLAGS) -DLOGLEVEL="((uint64_t)1 << $(shell awk '/$(shell basename $< .c)/ { print NR }' loglevels.tmp))" -c -o $@ $<
 
 all: src/cfgparse.y.o src/cfgparse.yy.o src/cmdparse.y.o src/cmdparse.yy.o ${FILES}
 	echo "LINK i3"
diff --git a/include/log.h b/include/log.h
index 6d529a00..9b284f0a 100644
--- a/include/log.h
+++ b/include/log.h
@@ -41,7 +41,7 @@ void set_verbosity(bool _verbose);
  * but only if the corresponding debug loglevel was activated.
  *
  */
-void debuglog(int lev, char *fmt, ...);
+void debuglog(uint64_t lev, char *fmt, ...);
 
 /**
  * Logs the given message to stdout while prefixing the current time to it.
diff --git a/src/log.c b/src/log.c
index 28b51423..a899efcb 100644
--- a/src/log.c
+++ b/src/log.c
@@ -21,7 +21,7 @@
 /* loglevels.h is autogenerated at make time */
 #include "loglevels.h"
 
-static uint32_t loglevel = 0;
+static uint64_t loglevel = 0;
 static bool verbose = true;
 
 /**
@@ -41,7 +41,7 @@ void set_verbosity(bool _verbose) {
 void add_loglevel(const char *level) {
 	/* Handle the special loglevel "all" */
 	if (strcasecmp(level, "all") == 0) {
-		loglevel = UINT32_MAX;
+		loglevel = UINT64_MAX;
 		return;
 	}
 
@@ -109,7 +109,7 @@ void errorlog(char *fmt, ...) {
  * This is to be called by DLOG() which includes filename/linenumber
  *
  */
-void debuglog(int lev, char *fmt, ...) {
+void debuglog(uint64_t lev, char *fmt, ...) {
 	va_list args;
 
 	if ((loglevel & lev) == 0)