From 94b241351c7418c2f6a32cc01b889bc48478c50d Mon Sep 17 00:00:00 2001 From: pommicket Date: Sun, 1 Jan 2023 23:35:55 -0500 Subject: replace @OPTIMIZE with @TODO --- buffer.c | 11 ++++++----- colors.c | 2 +- command.c | 2 +- config.c | 2 +- main.c | 1 - 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/buffer.c b/buffer.c index 2d80191..c7d5087 100644 --- a/buffer.c +++ b/buffer.c @@ -661,8 +661,8 @@ static Status buffer_edit_resize_prev_text(TextBuffer *buffer, BufferEdit *edit, // does this edit actually make a difference to the buffer? static bool buffer_edit_does_anything(TextBuffer *buffer, BufferEdit *edit) { if (edit->prev_len == edit->new_len) { - // @OPTIMIZE: compare directly to the buffer contents, rather than extracting them temporarily - // into new_text. + // @TODO(optimization): compare directly to the buffer contents, + // rather than extracting them temporarily into new_text. char32_t *new_text = buffer_calloc(buffer, edit->new_len, sizeof *new_text); if (new_text) { size_t len = buffer_get_text_at_pos(buffer, edit->pos, new_text, edit->new_len); @@ -1747,13 +1747,13 @@ void buffer_select_page_down(TextBuffer *buffer, i64 npages) { static void buffer_shorten_line(Line *line, u32 new_len) { assert(line->len >= new_len); - line->len = new_len; // @OPTIMIZE(memory): decrease line capacity + line->len = new_len; // @TODO(optimization,memory): decrease line capacity } // decrease the number of lines in the buffer. // DOES NOT DO ANYTHING TO THE LINES REMOVED! YOU NEED TO FREE THEM YOURSELF! static void buffer_shorten(TextBuffer *buffer, u32 new_nlines) { - buffer->nlines = new_nlines; // @OPTIMIZE(memory): decrease lines capacity + buffer->nlines = new_nlines; // @TODO(optimization,memory): decrease lines capacity } // delete `nlines` lines starting from index `first_line_idx` @@ -2002,7 +2002,8 @@ void buffer_newline(TextBuffer *buffer) { } if (settings->auto_indent) { // newline + auto-indent - char32_t *text = buffer_calloc(buffer, whitespace_len + 1, sizeof *text); // @OPTIMIZE: don't allocate on heap if whitespace_len is small + // @TODO(optimize): don't allocate on heap if whitespace_len is small + char32_t *text = buffer_calloc(buffer, whitespace_len + 1, sizeof *text); if (text) { text[0] = '\n'; memcpy(&text[1], line.str, whitespace_len * sizeof *text); diff --git a/colors.c b/colors.c index bc46d52..081d99e 100644 --- a/colors.c +++ b/colors.c @@ -58,7 +58,7 @@ static ColorName const color_names[] = { static_assert_if_possible(arr_count(color_names) == COLOR_COUNT) ColorSetting color_setting_from_str(const char *str) { - // @OPTIMIZE: sort color_names, binary search + // @TODO(optimize): sort color_names, binary search for (int i = 0; i < COLOR_COUNT; ++i) { ColorName const *n = &color_names[i]; if (streq(n->name, str)) diff --git a/command.c b/command.c index de31ae4..7180921 100644 --- a/command.c +++ b/command.c @@ -88,7 +88,7 @@ static CommandName const command_names[] = { static_assert_if_possible(arr_count(command_names) == CMD_COUNT) Command command_from_str(char const *str) { - // @OPTIMIZE: sort command_names, do a binary search + // @TODO(optimize): sort command_names, do a binary search for (int i = 0; i < CMD_COUNT; ++i) { if (streq(command_names[i].name, str)) return command_names[i].cmd; diff --git a/config.c b/config.c index fa4ab32..9081a70 100644 --- a/config.c +++ b/config.c @@ -292,7 +292,7 @@ static u32 config_parse_key_combo(ConfigReader *cfg, char const *str) { {"X2", "x2", SCANCODE_MOUSE_X2, 0} }; - // @OPTIMIZE: sort key_names (and split keyname1/2); do a binary search + // @TODO(optimize): sort key_names (and split keyname1/2); do a binary search for (size_t i = 0; i < arr_count(key_names); ++i) { KeyName const *k = &key_names[i]; if (streq(str, k->keyname1) || (k->keyname2 && streq(str, k->keyname2))) { diff --git a/main.c b/main.c index 87c22fe..bbe7aea 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,5 @@ /* @TODO: -- change @OPTIM(IZE) to @TODO - rename v[234] to vec[234] - handle multiple symbols with same name in go-to-definition menu - better non-error window/showMessage(Request) -- cgit v1.2.3