summaryrefslogtreecommitdiff
path: root/ted-base.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-25 19:34:30 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-25 19:34:30 -0500
commit9f8e74337832533a806ac0c46ee993a927f0c057 (patch)
treebbe437b4c3c68ea5c905ad957bb4307af2031354 /ted-base.c
parent795262f69900af674156bed2bcd0fdb57dbbb55e (diff)
error log, fix memory leak, moved globals to Ted
Diffstat (limited to 'ted-base.c')
-rw-r--r--ted-base.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ted-base.c b/ted-base.c
index 83c8208..b3a593e 100644
--- a/ted-base.c
+++ b/ted-base.c
@@ -43,19 +43,19 @@ static void *ted_realloc(Ted *ted, void *p, size_t new_size) {
}
// Check the various places a file could be, and return the full path.
-static Status ted_get_file(char const *name, char *out, size_t outsz) {
- if (ted_search_cwd && fs_file_exists(name)) {
+static Status ted_get_file(Ted const *ted, char const *name, char *out, size_t outsz) {
+ if (ted->search_cwd && fs_file_exists(name)) {
// check in current working directory
str_cpy(out, outsz, name);
return true;
}
- if (*ted_local_data_dir) {
- str_printf(out, outsz, "%s" PATH_SEPARATOR_STR "%s", ted_local_data_dir, name);
+ if (*ted->local_data_dir) {
+ str_printf(out, outsz, "%s" PATH_SEPARATOR_STR "%s", ted->local_data_dir, name);
if (fs_file_exists(out))
return true;
}
- if (*ted_global_data_dir) {
- str_printf(out, outsz, "%s" PATH_SEPARATOR_STR "%s", ted_global_data_dir, name);
+ if (*ted->global_data_dir) {
+ str_printf(out, outsz, "%s" PATH_SEPARATOR_STR "%s", ted->global_data_dir, name);
if (fs_file_exists(out))
return true;
}
@@ -66,7 +66,7 @@ static Status ted_get_file(char const *name, char *out, size_t outsz) {
// *out is left unchanged on failure.
static void ted_load_font(Ted *ted, char const *filename, Font **out) {
char font_filename[TED_PATH_MAX];
- if (ted_get_file(filename, font_filename, sizeof font_filename)) {
+ if (ted_get_file(ted, filename, font_filename, sizeof font_filename)) {
Font *font = text_font_load(font_filename, ted->settings.text_size);
if (font) {
if (*out) {