From e9fbb371df911947b8effde7a926d23bad6530d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 1 Dec 2019 19:22:25 +0100 Subject: [PATCH] fcft: font_from_name() no longer accepts a tllist --- main.c | 23 ++++++++++------------- terminal.c | 23 ++++++++++------------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/main.c b/main.c index 3666b5f4..fc007857 100644 --- a/main.c +++ b/main.c @@ -63,21 +63,18 @@ term_shutdown_cb(void *data, int exit_code) static bool initialize_fonts(const struct config *conf, struct font *fonts[4]) { - font_list_t font_names = tll_init(); + const size_t count = tll_length(conf->fonts); + const char *names[count]; + + size_t i = 0; tll_foreach(conf->fonts, it) - tll_push_back(font_names, it->item); + names[i++] = it->item; - if ((fonts[0] = font_from_name(font_names, "dpi=96")) == NULL || - (fonts[1] = font_from_name(font_names, "dpi=96:weight=bold")) == NULL || - (fonts[2] = font_from_name(font_names, "dpi=96:slant=italic")) == NULL || - (fonts[3] = font_from_name(font_names, "dpi=96:weight=bold:slant=italic")) == NULL) - { - tll_free(font_names); - return false; - } - - tll_free(font_names); - return true; + return ( + (fonts[0] = font_from_name(names, count, "dpi=96")) != NULL && + (fonts[1] = font_from_name(names, count, "dpi=96:weight=bold")) != NULL && + (fonts[2] = font_from_name(names, count, "dpi=96:slant=italic")) != NULL && + (fonts[3] = font_from_name(names, count, "dpi=96:weight=bold:slant=italic")) != NULL); } int diff --git a/terminal.c b/terminal.c index c49c34df..31046df9 100644 --- a/terminal.c +++ b/terminal.c @@ -368,21 +368,18 @@ initialize_render_workers(struct terminal *term) static bool initialize_fonts(struct terminal *term, const struct config *conf) { - font_list_t font_names = tll_init(); + const size_t count = tll_length(conf->fonts); + const char *names[count]; + + size_t i = 0; tll_foreach(conf->fonts, it) - tll_push_back(font_names, it->item); + names[i++] = it->item; - if ((term->fonts[0] = font_from_name(font_names, "dpi=96")) == NULL || - (term->fonts[1] = font_from_name(font_names, "dpi=96:weight=bold")) == NULL || - (term->fonts[2] = font_from_name(font_names, "dpi=96:slant=italic")) == NULL || - (term->fonts[3] = font_from_name(font_names, "dpi=96:weight=bold:slant=italic")) == NULL) - { - tll_free(font_names); - return false; - } - - tll_free(font_names); - return true; + return ( + (term->fonts[0] = font_from_name(names, count, "dpi=96")) != NULL && + (term->fonts[1] = font_from_name(names, count, "dpi=96:weight=bold")) != NULL && + (term->fonts[2] = font_from_name(names, count, "dpi=96:slant=italic")) != NULL && + (term->fonts[3] = font_from_name(names, count, "dpi=96:weight=bold:slant=italic")) != NULL); } struct terminal *