summaryrefslogtreecommitdiff
path: root/ted-base.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-21 11:50:51 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-21 11:50:51 -0500
commitdd91d6c72625cc7ed2ec5954a5cbca35fd7655d4 (patch)
tree4b1e52098e3fdbb9a36395c33ad057b7cbaf0d01 /ted-base.c
parent3d86329abd754319a36459f8eb3e4bce6efffe1e (diff)
split file selector into its own thing
Diffstat (limited to 'ted-base.c')
-rw-r--r--ted-base.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/ted-base.c b/ted-base.c
index 2eac197..c3aff0e 100644
--- a/ted-base.c
+++ b/ted-base.c
@@ -86,17 +86,15 @@ static void ted_load_font(Ted *ted) {
}
}
-// returns buffer of new file
-static TextBuffer *ted_open_file(Ted *ted, char const *filename) {
+// returns buffer of new file, or NULL on failure
+static WarnUnusedResult TextBuffer *ted_open_file(Ted *ted, char const *filename) {
TextBuffer *open_to = &ted->main_buffer;
- buffer_load_file(open_to, filename);
- if (buffer_haserr(open_to)) {
- // @TODO: something
- ted_seterr_to_buferr(ted, open_to);
- return NULL;
- } else {
+ if (buffer_load_file(open_to, filename)) {
ted->active_buffer = open_to;
return open_to;
+ } else {
+ ted_seterr_to_buferr(ted, open_to);
+ return NULL;
}
}