From fd7c76fc987dcaa928139ac4991ea02e61a2a1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 8 Oct 2019 21:57:23 +0200 Subject: Remove tailing null from parsed color files. --- src/calendar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3