aboutsummaryrefslogtreecommitdiffstats
path: root/buffer.c
diff options
context:
space:
mode:
authornytpu <alex@nytpu.com>2021-05-31 13:07:51 -0600
committernytpu <alex@nytpu.com>2021-05-31 13:07:51 -0600
commitecda2b07ad1baa472b64db7a789ad85a91cc9621 (patch)
tree1e3b45915920b8982d370d1e0ac89f6cebbb64f8 /buffer.c
parentfixup makefile (diff)
downloaded-ecda2b07ad1baa472b64db7a789ad85a91cc9621.tar.bz2
ed-ecda2b07ad1baa472b64db7a789ad85a91cc9621.zip
add RowNum define
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/buffer.c b/buffer.c
index fecea28..54fa51d 100644
--- a/buffer.c
+++ b/buffer.c
@@ -13,13 +13,13 @@
struct Buffer B;
void
-insert_row(long at, char *r, size_t len)
+insert_row(RowNum at, char *r, size_t len)
{
if (at > B.numrows) return;
B.rows = realloc(B.rows, (B.numrows+1) * sizeof(struct Row));
if (at != B.numrows) {
memmove(&B.rows[at+1], &B.rows[at], (B.numrows-at) * sizeof(struct Row));
- for (long i = at+1; i <= B.numrows; ++i) ++B.rows[i].idx;
+ for (RowNum i = at+1; i <= B.numrows; ++i) ++B.rows[i].idx;
}
B.rows[at].size = len;
@@ -31,12 +31,12 @@ insert_row(long at, char *r, size_t len)
}
void
-delete_row(long at)
+delete_row(RowNum at)
{
if (at >= B.numrows) return;
free(B.rows[at].chars);
memmove(&B.rows[at], &B.rows[at+1], (B.numrows-at-1) * sizeof(struct Row));
- for (long i = at; i < B.numrows; ++i) --B.rows[i].idx;
+ for (RowNum i = at; i < B.numrows; ++i) --B.rows[i].idx;
--B.numrows;
B.dirty = true;
}