diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-19 10:22:52 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-01-19 10:22:52 -0500 |
commit | 7ba80aaa38c95fdb84cd8fb51d51b5d897c5de95 (patch) | |
tree | 3bc8daa12db1b25301e775967f2b423386f11e9b /buffer.c | |
parent | 8a4984e0e15fcfb0be6db242ab3f60325b80abd8 (diff) |
opening files by clicking on them
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -74,7 +74,7 @@ static char *buffer_strdup(TextBuffer *buffer, char const *src) { } void buffer_create(TextBuffer *buffer, Ted *ted) { - util_zero_memory(buffer, sizeof *buffer); + memset(buffer, 0, sizeof *buffer); buffer->store_undo_events = true; buffer->ted = ted; } @@ -459,7 +459,7 @@ void buffer_free(TextBuffer *buffer) { arr_free(buffer->undo_history); arr_free(buffer->redo_history); - util_zero_memory(buffer, sizeof *buffer); + memset(buffer, 0, sizeof *buffer); } // clear contents, undo history, etc. of a buffer @@ -474,6 +474,7 @@ void buffer_clear(TextBuffer *buffer) { } else { buffer_create(buffer, ted); } + memcpy(buffer->error, error, sizeof error); } void buffer_load_file(TextBuffer *buffer, char const *filename) { @@ -1128,7 +1129,7 @@ static Status buffer_insert_lines(TextBuffer *buffer, u32 where, u32 number) { buffer->lines + where, (old_nlines - where) * sizeof *buffer->lines); // zero new lines - util_zero_memory(buffer->lines + where, number * sizeof *buffer->lines); + memset(buffer->lines + where, 0, number * sizeof *buffer->lines); buffer->nlines = new_nlines; return true; } |