summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2014-09-08 09:38:54 -0400
committerQuentin Carbonneaux2014-09-08 09:39:07 -0400
commitde06a641b64a5e0aadb982b9714607cc5611b231 (patch)
treec8bd1d5c14b247fd4bc46a0057429737093329f0
parent7b186bbeef8d205a90b800a69bb7504c7c3614fd (diff)
use a reasonable buffer size
-rw-r--r--buf.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/buf.h b/buf.h
index 615ea08..93e291e 100644
--- a/buf.h
+++ b/buf.h
@@ -4,24 +4,24 @@ typedef struct page Page;
typedef struct buf Buf;
enum {
- PageLen = 11,
+ PageLen = 1024 - 8,
};
struct page {
- int len;
- int nl;
- int col;
- Rune *hbeg;
- Rune buf[PageLen];
- Page *p;
- Page *n;
+ int len; /* page length */
+ short nl; /* number of \n in page */
+ short col; /* column of the first rune */
+ Rune *hbeg; /* start of the hole */
+ Page *p; /* link to previous */
+ Page *n; /* link to next */
+ Rune buf[PageLen]; /* buffer */
};
struct buf {
- Page *p;
- Page *last;
- unsigned lastbeg;
- unsigned limbo;
+ Page *p; /* first page */
+ Page *last; /* cached page */
+ unsigned lastbeg; /* buffer offset of last */
+ unsigned limbo; /* limbo offset */
};
void buf_init(Buf *);