aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-10-08 21:57:23 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-10-08 21:57:23 +0200
commitfd7c76fc987dcaa928139ac4991ea02e61a2a1d7 (patch)
tree358aaae1e92442c68cb6b221b81f9d862253137e
parentSlight impromevents to parse-offset. (diff)
downloadcalp-fd7c76fc987dcaa928139ac4991ea02e61a2a1d7.tar.gz
calp-fd7c76fc987dcaa928139ac4991ea02e61a2a1d7.tar.xz
Remove tailing null from parsed color files.
-rw-r--r--src/calendar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/calendar.c b/src/calendar.c
index 1362ee2e..28891330 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -92,12 +92,14 @@ int handle_dir(SCM cal, char* path) {
if (strcmp (d->d_name, "color") == 0) {
f = fopen(resolved_path, "r");
read = getline(&info_buf, &size, f);
+ // TODO this isn't actually needed since we trim the
+ // string into an SCM string directly here.
if (info_buf[read - 1] == '\n')
info_buf[read - 1] = '\0';
fclose(f);
scm_add_line_x(cal, scm_from_utf8_string("COLOR"),
- scm_make_vline(scm_from_utf8_stringn(info_buf, read)));
+ scm_make_vline(scm_from_utf8_stringn(info_buf, read - 1)));
} else if (strcmp (d->d_name, "displayname") == 0) {
f = fopen(resolved_path, "r");
read = getline(&info_buf, &size, f);