aboutsummaryrefslogtreecommitdiff
path: root/src/text_file.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-01-17 12:52:11 +0100
committerMax Kellermann <max@duempel.org>2010-01-17 12:52:11 +0100
commit02526eda86065b52ce05b6763d479006966b8de2 (patch)
treefc92c8b5d211681e700a219b4f082fccd2d5b53b /src/text_file.c
parent828a5f552f5d2cff01e588af7b686099687a7bac (diff)
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.
Diffstat (limited to 'src/text_file.c')
-rw-r--r--src/text_file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/text_file.c b/src/text_file.c
index 80559b78..355217ab 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;
}