aboutsummaryrefslogtreecommitdiffstats
path: root/libfonts_get_default_font.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-01-08 17:13:25 +0100
committerMattias Andrée <maandree@kth.se>2023-01-08 17:13:25 +0100
commitb5471b4ba742879de17f7ea777bb0dd62c14b81f (patch)
tree37d7abc4f84373ed92059ccd59f6e4a4df2f77ae /libfonts_get_default_font.c
parentm (diff)
downloadlibfonts-b5471b4ba742879de17f7ea777bb0dd62c14b81f.tar.gz
libfonts-b5471b4ba742879de17f7ea777bb0dd62c14b81f.tar.bz2
libfonts-b5471b4ba742879de17f7ea777bb0dd62c14b81f.tar.xz
struct libfonts_context will be used to print warnings
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libfonts_get_default_font.c')
-rw-r--r--libfonts_get_default_font.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/libfonts_get_default_font.c b/libfonts_get_default_font.c
index 25b18e1..5661e5c 100644
--- a/libfonts_get_default_font.c
+++ b/libfonts_get_default_font.c
@@ -4,13 +4,13 @@
static char *
-find(const char *dir_part1, const char *dir_part2, const char *dir_part3)
+find(const char *dir_part1, const char *dir_part2, const char *dir_part3, struct libfonts_context *ctx)
{
return NULL; /* TODO */
}
static char *
-getn(const char *file_part1, size_t file_part1_len, const char *file_part2, const char *name)
+getn(const char *file_part1, size_t file_part1_len, const char *file_part2, const char *name, struct libfonts_context *ctx)
{
size_t file_part2_len = strlen(file_part2);
char *path;
@@ -39,9 +39,9 @@ getn(const char *file_part1, size_t file_part1_len, const char *file_part2, cons
}
static char *
-get(const char *file_part1, const char *file_part2, const char *name)
+get(const char *file_part1, const char *file_part2, const char *name, struct libfonts_context *ctx)
{
- return getn(file_part1, strlen(file_part1), file_part2, name);
+ return getn(file_part1, strlen(file_part1), file_part2, name, ctx);
}
char *
@@ -72,51 +72,51 @@ libfonts_get_default_font(enum libfonts_default_font font, struct libfonts_conte
confenv = libfonts_getenv__("XDG_CONFIG_HOME", ctx);
if (confenv && *confenv) {
- ret = get(confenv, "/libfonts/default-fonts.conf", var);
+ ret = get(confenv, "/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
homeenv = libfonts_getenv__("HOME", ctx);
if (homeenv && *homeenv) {
- ret = get(homeenv, "/.config/libfonts/default-fonts.conf", var);
+ ret = get(homeenv, "/.config/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
- ret = get(homeenv, "/.libfonts/default-fonts.conf", var);
+ ret = get(homeenv, "/.libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
home = libfonts_gethome__(ctx);
if (home && *home) {
- ret = get(home, "/.config/libfonts/default-fonts.conf", var);
+ ret = get(home, "/.config/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
- ret = get(home, "/.libfonts/default-fonts.conf", var);
+ ret = get(home, "/.libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
if (confenv && *confenv) {
- ret = find(env, "/libfonts/", var);
+ ret = find(env, "/libfonts/", var, ctx);
if (ret)
goto out;
}
if (homeenv && *homeenv) {
- ret = find(homeenv, "/.config/libfonts/", var);
+ ret = find(homeenv, "/.config/libfonts/", var, ctx);
if (ret)
goto out;
- ret = find(homeenv, "/.libfonts/", var);
+ ret = find(homeenv, "/.libfonts/", var, ctx);
if (ret)
goto out;
}
if (home && *home) {
- ret = find(home, "/.config/libfonts/", var);
+ ret = find(home, "/.config/libfonts/", var, ctx);
if (ret)
goto out;
- ret = find(home, "/.libfonts/", var);
+ ret = find(home, "/.libfonts/", var, ctx);
if (ret)
goto out;
}
@@ -127,7 +127,7 @@ libfonts_get_default_font(enum libfonts_default_font font, struct libfonts_conte
next = strchr(&env[1], ':');
len = next ? (size_t)(next - env) : strlen(env);
if (len) {
- ret = getn(env, len, "/libfonts/default-fonts.conf", var);
+ ret = getn(env, len, "/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
}
@@ -135,11 +135,11 @@ libfonts_get_default_font(enum libfonts_default_font font, struct libfonts_conte
} while (next);
}
- ret = get("/etc", "/libfonts/default-fonts.conf", var);
+ ret = get("/etc", "/libfonts/default-fonts.conf", var, ctx);
if (ret)
goto out;
- ret = find("/etc", "/libfonts/", var);
+ ret = find("/etc", "/libfonts/", var, ctx);
if (ret)
goto out;