diff options
author | KatolaZ <katolaz@freaknet.org> | 2019-08-01 16:42:36 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2019-08-01 16:42:36 +0100 |
commit | 82a7c12e8338288ccb40d213fcc9e15d102aa968 (patch) | |
tree | 970ca2f39dc599624e53a10e59d05bc908f9b0a2 /lineset.c | |
parent | 62713aaf65264950aecad9237d50e911d7dad893 (diff) |
remove trailing blank lines in write_file - change check_bound
Diffstat (limited to 'lineset.c')
-rw-r--r-- | lineset.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -144,13 +144,18 @@ void copy_lines_to_ring(int y1, int y2, int which){ else idx = undo_cur + 1; if (idx >= undo_sz - 1){ - undo_sz += 10; - tmp = realloc(undo, undo_sz * sizeof(lineset_t)); + tmp = realloc(undo, (undo_sz + 10) * sizeof(lineset_t)); if (tmp == NULL){ fprintf(stderr, "Error allocating undo buffer"); exit(1); } undo = tmp; + for (i=0; i<10; i++){ + undo[undo_sz + i].sz = 0; + undo[undo_sz + i].l = NULL; + undo[undo_sz + i].num = 0; + } + undo_sz += 10; } ensure_num_lines(&(undo[idx]), y2 - y1 + 1); for(i=y1; i<=y2; i++){ |