From 02526eda86065b52ce05b6763d479006966b8de2 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Sun, 17 Jan 2010 12:52:11 +0100
Subject: text_file: don't strip trailing whitespace

Only delete the newline characters (\n and optionally \r).  This
allows the database file to store file names with trailing whitespace.
---
 src/text_file.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/text_file.c b/src/text_file.c
index 80559b785..355217aba 100644
--- a/src/text_file.c
+++ b/src/text_file.c
@@ -57,7 +57,12 @@ read_text_line(FILE *file, GString *buffer)
 		g_string_set_size(buffer, length + step);
 	}
 
+	/* remove the newline characters */
+	if (buffer->str[length - 1] == '\n')
+		--length;
+	if (buffer->str[length - 1] == '\r')
+		--length;
+
 	g_string_set_size(buffer, length);
-	g_strchomp(buffer->str);
 	return buffer->str;
 }
-- 
cgit v1.2.3