summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-19 10:22:52 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-19 10:22:52 -0500
commit7ba80aaa38c95fdb84cd8fb51d51b5d897c5de95 (patch)
tree3bc8daa12db1b25301e775967f2b423386f11e9b /buffer.c
parent8a4984e0e15fcfb0be6db242ab3f60325b80abd8 (diff)
opening files by clicking on them
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/buffer.c b/buffer.c
index 477a1c9..9481236 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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;
}