aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-11-05 13:17:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-11-13 10:04:27 +0000
commit70aec2068a89c46263e81ced7b06c5d9e169e1ba (patch)
tree46abb5c024d7f2a4dc396b50037cd2daa416e72a
parentconfig: rename str_to_wchars() -> value_to_wchars() (diff)
config: rename str_to_fonts() -> value_to_fonts()
-rw-r--r--config.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/config.c b/config.c
index f4b1e55f..08a751fc 100644
--- a/config.c
+++ b/config.c
@@ -586,14 +586,16 @@ value_to_pt_or_px(struct context *ctx, struct pt_or_px *res)
}
static struct config_font_list NOINLINE
-str_to_fonts(const char *s, struct config *conf, const char *path, int lineno,
- const char *section, const char *key)
+value_to_fonts(struct context *ctx)
{
+ /* TODO: remove! */
+ struct config *conf = ctx->conf;
+
size_t count = 0;
size_t size = 0;
struct config_font *fonts = NULL;
- char *copy = xstrdup(s);
+ char *copy = xstrdup(ctx->value);
for (const char *font = strtok(copy, ",");
font != NULL;
font = strtok(NULL, ","))
@@ -609,7 +611,7 @@ str_to_fonts(const char *s, struct config *conf, const char *path, int lineno,
if (!config_font_parse(font, &font_data)) {
LOG_AND_NOTIFY_ERR(
"%s:%d: [%s].%s: %s: invalid font specification",
- path, lineno, section, key, font);
+ ctx->path, ctx->lineno, ctx->section, ctx->key, font);
goto err;
}
@@ -937,9 +939,7 @@ parse_section_main(struct context *ctx)
strcmp(key, "font-bold") == 0 ? 1 :
strcmp(key, "font-italic") == 0 ? 2 : 3;
- struct config_font_list new_list = str_to_fonts(
- value, conf, path, lineno, "main", key);
-
+ struct config_font_list new_list = value_to_fonts(ctx);
if (new_list.arr == NULL)
return false;
@@ -1521,9 +1521,7 @@ parse_section_csd(struct context *ctx)
}
else if (strcmp(key, "font") == 0) {
- struct config_font_list new_list = str_to_fonts(
- value, conf, path, lineno, "csd", "font");
-
+ struct config_font_list new_list = value_to_fonts(ctx);
if (new_list.arr == NULL)
return false;