diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-11-18 17:19:52 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-11-18 17:19:52 +0000 |
commit | 9acacbb7501db6c7ac4bf2362b21871f00e9577f (patch) | |
tree | d4e008902c42f6dc0da7d71252c1c2dc8860f7d1 /usr.bin/mg/line.c | |
parent | 4e684501c9e0dd1a3a446a3b01e54aabedab487b (diff) |
Kill a stupid interface. kgrow should take direction, not TRUE/FALSE.
Diffstat (limited to 'usr.bin/mg/line.c')
-rw-r--r-- | usr.bin/mg/line.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index 0831136110a..0c8311fc6f6 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,4 +1,4 @@ -/* $OpenBSD: line.c,v 1.25 2005/10/13 20:28:49 deraadt Exp $ */ +/* $OpenBSD: line.c,v 1.26 2005/11/18 17:19:51 kjell Exp $ */ /* This file is in the public domain. */ @@ -462,13 +462,13 @@ ldelete(RSIZE n, int kflag) cp1 = &dotp->l_text[doto]; if (kflag == KFORW) { while (ksize - kused < chunk) - if (kgrow(FALSE) == FALSE) + if (kgrow(kflag) == FALSE) return (FALSE); bcopy(cp1, &(kbufp[kused]), (int)chunk); kused += chunk; } else if (kflag == KBACK) { while (kstart < chunk) - if (kgrow(TRUE) == FALSE) + if (kgrow(kflag) == FALSE) return (FALSE); bcopy(cp1, &(kbufp[kstart - chunk]), (int)chunk); kstart -= chunk; @@ -626,9 +626,9 @@ kdelete(void) int kinsert(int c, int dir) { - if (kused == ksize && dir == KFORW && kgrow(FALSE) == FALSE) + if (kused == ksize && dir == KFORW && kgrow(dir) == FALSE) return (FALSE); - if (kstart == 0 && dir == KBACK && kgrow(TRUE) == FALSE) + if (kstart == 0 && dir == KBACK && kgrow(dir) == FALSE) return (FALSE); if (dir == KFORW) kbufp[kused++] = c; @@ -640,11 +640,11 @@ kinsert(int c, int dir) } /* - * kgrow - just get more kill buffer for the callee. back is true if + * kgrow - just get more kill buffer for the callee. If dir = KBACK * we are trying to get space at the beginning of the kill buffer. */ static int -kgrow(int back) +kgrow(int dir) { int nstart; char *nbufp; @@ -658,7 +658,7 @@ kgrow(int back) ewprintf("Can't get %ld bytes", (long)(ksize + KBLOCK)); return (FALSE); } - nstart = (back == TRUE) ? (kstart + KBLOCK) : (KBLOCK / 4); + nstart = (dir == KBACK) ? (kstart + KBLOCK) : (KBLOCK / 4); bcopy(&(kbufp[kstart]), &(nbufp[nstart]), (int)(kused - kstart)); if (kbufp != NULL) free((char *)kbufp); |