From fd866bf94487ee39cccdaea749407faa487fcee5 Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 2 Jan 2023 14:25:30 -0500 Subject: Status => bool on a few functions --- command.c | 6 +++--- menu.c | 2 +- ted.c | 6 +++--- ted.h | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/command.c b/command.c index a21647c..0347544 100644 --- a/command.c +++ b/command.c @@ -311,7 +311,7 @@ void command_execute(Ted *ted, Command c, i64 argument) { menu_open(ted, MENU_OPEN); break; case CMD_NEW: - (void)ted_new_file(ted, NULL); + ted_new_file(ted, NULL); break; case CMD_SAVE: ted->last_save_time = ted->frame_time; @@ -331,7 +331,7 @@ void command_execute(Ted *ted, Command c, i64 argument) { break; case CMD_SAVE_ALL: ted->last_save_time = ted->frame_time; - (void)ted_save_all(ted); + ted_save_all(ted); break; case CMD_RELOAD_ALL: ted_reload_all(ted); @@ -412,7 +412,7 @@ void command_execute(Ted *ted, Command c, i64 argument) { case CMD_OPEN_CONFIG: { char local_config_filename[TED_PATH_MAX]; strbuf_printf(local_config_filename, "%s" PATH_SEPARATOR_STR TED_CFG, ted->local_data_dir); - (void)ted_open_file(ted, local_config_filename); + ted_open_file(ted, local_config_filename); } break; case CMD_COMMAND_SELECTOR: menu_open(ted, MENU_COMMAND_SELECTOR); diff --git a/menu.c b/menu.c index 3a71a9f..d6d954f 100644 --- a/menu.c +++ b/menu.c @@ -181,7 +181,7 @@ void menu_update(Ted *ted) { if (selected_file) { // open that file! menu_close(ted); - (void)ted_open_file(ted, selected_file); + ted_open_file(ted, selected_file); free(selected_file); } } break; diff --git a/ted.c b/ted.c index 627f413..840244d 100644 --- a/ted.c +++ b/ted.c @@ -377,7 +377,7 @@ TextBuffer *ted_get_buffer_with_file(Ted *ted, const char *path) { return NULL; } -Status ted_open_file(Ted *ted, const char *filename) { +bool ted_open_file(Ted *ted, const char *filename) { char path[TED_PATH_MAX]; ted_path_full(ted, filename, path, sizeof path); @@ -408,7 +408,7 @@ Status ted_open_file(Ted *ted, const char *filename) { } } -Status ted_new_file(Ted *ted, const char *filename) { +bool ted_new_file(Ted *ted, const char *filename) { u16 buffer_idx, tab_idx; char path[TED_PATH_MAX]; if (filename) @@ -432,7 +432,7 @@ Status ted_new_file(Ted *ted, const char *filename) { } -Status ted_save_all(Ted *ted) { +bool ted_save_all(Ted *ted) { bool success = true; bool *buffers_used = ted->buffers_used; for (u16 i = 0; i < TED_MAX_BUFFERS; ++i) { diff --git a/ted.h b/ted.h index 83b3a08..8445808 100644 --- a/ted.h +++ b/ted.h @@ -726,7 +726,7 @@ void buffer_copy_or_cut(TextBuffer *buffer, bool cut); void buffer_copy(TextBuffer *buffer); void buffer_cut(TextBuffer *buffer); void buffer_paste(TextBuffer *buffer); -Status buffer_load_file(TextBuffer *buffer, const char *filename); +bool buffer_load_file(TextBuffer *buffer, const char *filename); void buffer_reload(TextBuffer *buffer); bool buffer_externally_changed(TextBuffer *buffer); void buffer_new_file(TextBuffer *buffer, const char *filename); @@ -1042,7 +1042,7 @@ void ted_seterr_to_buferr(Ted *ted, TextBuffer *buffer); bool ted_haserr(Ted *ted); // Returns the buffer containing the file at `path`, or NULL if there is none. TextBuffer *ted_get_buffer_with_file(Ted *ted, const char *path); -Status ted_save_all(Ted *ted); +bool ted_save_all(Ted *ted); void ted_reload_all(Ted *ted); const char *ted_geterr(Ted *ted); // Load all the fonts ted will use. @@ -1057,8 +1057,8 @@ LSP *ted_get_lsp_by_id(Ted *ted, LSPID id); LSP *ted_get_lsp(Ted *ted, const char *path, Language language); LSP *ted_active_lsp(Ted *ted); u32 ted_color(Ted *ted, ColorSetting color); -Status ted_open_file(Ted *ted, const char *filename); -Status ted_new_file(Ted *ted, const char *filename); +bool ted_open_file(Ted *ted, const char *filename); +bool ted_new_file(Ted *ted, const char *filename); // returns the index of an available buffer, or -1 if none are available i32 ted_new_buffer(Ted *ted); // Returns the index of an available node, or -1 if none are available @@ -1067,7 +1067,7 @@ i32 ted_new_node(Ted *ted); // Make sure you set active_buffer to something else if you delete it! void ted_delete_buffer(Ted *ted, u16 index); // save all changes to all buffers with unsaved changes. -Status ted_save_all(Ted *ted); +bool ted_save_all(Ted *ted); // sets the active buffer to this buffer, and updates active_node, etc. accordingly // you can pass NULL to buffer to make it so no buffer is active. void ted_switch_to_buffer(Ted *ted, TextBuffer *buffer); -- cgit v1.2.3