From: Arun Prakash Jana <engineerarun@gmail.com>
Date: Mon, 9 Dec 2019 17:47:40 +0000 (+0530)
Subject: Print line number in debug logs
X-Git-Tag: v2.9~197
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=b14e1a4856145c1414267bcedb1b91618e2f7c06;p=nnn.git

Print line number in debug logs
---

diff --git a/src/dbg.h b/src/dbg.h
index 28f41181..114b6cab 100644
--- a/src/dbg.h
+++ b/src/dbg.h
@@ -76,10 +76,13 @@ static void disabledbg(void)
 	close(DEBUG_FD);
 }
 
-#define DPRINTF_D(x) xprintf(DEBUG_FD, #x "=%d [ln %d]\n", x, __LINE__)
-#define DPRINTF_U(x) xprintf(DEBUG_FD, #x "=%u [ln %d]\n", x, __LINE__)
-#define DPRINTF_S(x) xprintf(DEBUG_FD, #x "=%s [ln %d]\n", x, __LINE__)
-#define DPRINTF_P(x) xprintf(DEBUG_FD, #x "=%p [ln %d]\n", x, __LINE__)
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
+#define DPRINTF_D(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%d\n", x, __LINE__)
+#define DPRINTF_U(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%u\n", x)
+#define DPRINTF_S(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%s\n", x)
+#define DPRINTF_P(x) xprintf(DEBUG_FD, "ln " TOSTRING(__LINE__) ": " #x "=%p\n", x)
 #else
 #define DPRINTF_D(x)
 #define DPRINTF_U(x)
diff --git a/src/nnn.c b/src/nnn.c
index a1cc4449..ebcf6b17 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1891,7 +1891,7 @@ static int nextsel(int presel)
 
 	if (c == 0 || c == MSGWAIT) {
 		c = getch();
-		DPRINTF_D(c);
+		//DPRINTF_D(c);
 
 		if (presel == MSGWAIT) {
 			if (cfg.filtermode)
@@ -4017,7 +4017,7 @@ static void redraw(char *path)
 		return;
 	}
 
-	DPRINTF_D(cur);
+	//DPRINTF_D(cur);
 	DPRINTF_S(path);
 
 	addch('[');