From 91e34655413e4bdc1e26ccc8e0206e26ca5b629f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=ADle=20Ekaterin=20Liszka?= Date: Mon, 27 Nov 2023 16:43:49 -0800 Subject: [PATCH] src: more code fixes --- meson.build | 2 +- src/font.c | 2 +- src/script.c | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 168f37d..6e310f1 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ libtoml_dep = dependency( exe = executable( 'smeargle', - ['src/main.c', 'src/font.c'], + ['src/main.c', 'src/font.c', 'src/script.c'], dependencies: libtoml_dep, install: true ) \ No newline at end of file diff --git a/src/font.c b/src/font.c index e5ddbf2..534c668 100644 --- a/src/font.c +++ b/src/font.c @@ -51,7 +51,7 @@ font_t font_create(char *font_name, char *filename) { void font_destroy(font_t font) { map_destroy(font.map); free(font.name); - free(font.toml_filename); + free(font.image_filename); } unsigned int map_create(toml_table_t *table, map_t **map) { diff --git a/src/script.c b/src/script.c index 4079066..2fc030e 100644 --- a/src/script.c +++ b/src/script.c @@ -1,4 +1,6 @@ +#include + #include "script.h" #include "util.h" @@ -10,7 +12,7 @@ script_t script_create(toml_table_t *table) { if (!(var).ok) {\ char str[200];\ snprintf(str, 200, "key '%s' missing from", (key)); \ - error(str, filename); \ + error(str, filename.u.s); \ } TOML_GET_KEY(filename, "filename", toml_string_in) TOML_GET_KEY(font_name, "font", toml_string_in) @@ -26,13 +28,13 @@ script_t script_create(toml_table_t *table) { #undef TOML_GET_KEY toml_table_t *fonts = toml_table_in(table, "font"); - toml_datum_t font_filename = toml_string_in(fonts, font_name); + toml_datum_t font_filename = toml_string_in(fonts, font_name.u.s); if (!font_filename.ok) { - char str[200] + char str[200]; snprintf(str, 200, "failed to obtain data for font %s", font_name); error(str, ""); } - font = font_create(font_name, font_filename); + font = font_create(font_name.u.s, font_filename.u.s); script.filename = filename.u.s; script.font = font;