sled

Једноставни уређивач текста
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 9996d67f2c653258ee68ce75c51d07865e7f8343
родитељ 56444dedb80e4697eb3c50dc4d3cc5f5522ca886
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Sun, 20 Feb 2022 00:55:06 +0100

Add TODO comments for check

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Msled.c | 15+++++++++------
измењених датотека: 1, додавања: 9(+), брисања: 6(-)

diff --git a/sled.c b/sled.c @@ -172,8 +172,8 @@ reread_file(struct DrawState* state) void go_to_line_callback(struct DrawState* state) { - size_t lineno = 0; - size_t len = 0; + size_t lineno = 0; + size_t len = 0; char* u8_input = NULL; if (!state) @@ -181,7 +181,7 @@ go_to_line_callback(struct DrawState* state) if (*state->input) { - len = u32_strlen(state->input); + len = u32_strlen(state->input); u8_input = calloc(len + 1, UTF8REPMAX); if (!u8_input) { @@ -189,7 +189,7 @@ go_to_line_callback(struct DrawState* state) return; } unicode_string_to_u8(u8_input, state->input, len + 1); - errno = 0; + errno = 0; lineno = strtoul(u8_input, NULL, 10); if (errno) strcpy(state->error, errors[ERR_INVALID_NUM]); @@ -269,15 +269,17 @@ load_file(struct DrawState* state, long* lineno, long* col) if (line == state->buffer + state->buffer_size) { state->buffer_size += ALLOC_DELTA; + /* TODO: Allocated here */ newchunk = realloc(state->buffer, state->buffer_size * sizeof(struct BufferLine)); if (!newchunk) return LOAD_ERR_CANT_ALLOC; state->buffer = newchunk; + init_bufferline(state->buffer + state->buffer_size + - ALLOC_DELTA); line = state->buffer + state->buffer_size - ALLOC_DELTA; - init_bufferline(line); } - if (!line->text) + if (!line->text) /* TODO: Uninitialized value? */ { newtext = calloc(MAXBUFLINE, sizeof(uint32_t)); if (!newtext) @@ -1461,6 +1463,7 @@ erase_selection(struct DrawState* state) state->buffer[ssr + row + 1].length = state->buffer[ser + row + 1].length; } + /* TODO: Check! */ for (size_t row = state->rows_count - (ser - ssr); row < state->rows_count; row++) {