diff options
author | Russ Cox <russcox@gmail.com> | 2009-09-16 16:46:07 -0400 |
---|---|---|
committer | Russ Cox <russcox@gmail.com> | 2009-09-16 16:46:07 -0400 |
commit | cfa81d56c6727c3adcaa160c202c914696097c58 (patch) | |
tree | 6e69bcf656a99307e52f75c422b89a7d6dbc0aaa /src/cmd/ed.c | |
parent | 16e65a6d780d182ae8c1992a23952c567468a01c (diff) | |
download | plan9port-cfa81d56c6727c3adcaa160c202c914696097c58.tar.gz plan9port-cfa81d56c6727c3adcaa160c202c914696097c58.tar.bz2 plan9port-cfa81d56c6727c3adcaa160c202c914696097c58.zip |
ed: update to 32-bit Runes
http://codereview.appspot.com/116119
Diffstat (limited to 'src/cmd/ed.c')
-rw-r--r-- | src/cmd/ed.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/cmd/ed.c b/src/cmd/ed.c index 1f477a99..77a0c27e 100644 --- a/src/cmd/ed.c +++ b/src/cmd/ed.c @@ -55,7 +55,7 @@ Reprog *pattern; int peekc; int pflag; int rescuing; -Rune rhsbuf[LBSIZE/2]; +Rune rhsbuf[LBSIZE/sizeof(Rune)]; char savedfile[FNSIZE]; jmp_buf savej; int subnewa; @@ -1009,11 +1009,11 @@ getline(int tl) lp = linebuf; bp = getblock(tl, OREAD); nl = nleft; - tl &= ~((BLKSIZE/2) - 1); + tl &= ~((BLKSIZE/sizeof(Rune)) - 1); while(*lp++ = *bp++) { nl -= sizeof(Rune); if(nl == 0) { - bp = getblock(tl += BLKSIZE/2, OREAD); + bp = getblock(tl += BLKSIZE/sizeof(Rune), OREAD); nl = nleft; } } @@ -1031,7 +1031,7 @@ putline(void) tl = tline; bp = getblock(tl, OWRITE); nl = nleft; - tl &= ~((BLKSIZE/2)-1); + tl &= ~((BLKSIZE/sizeof(Rune))-1); while(*bp = *lp++) { if(*bp++ == '\n') { bp[-1] = 0; @@ -1040,7 +1040,7 @@ putline(void) } nl -= sizeof(Rune); if(nl == 0) { - tl += BLKSIZE/2; + tl += BLKSIZE/sizeof(Rune); bp = getblock(tl, OWRITE); nl = nleft; } @@ -1072,8 +1072,8 @@ getblock(int atl, int iof) static uchar ibuff[BLKSIZE]; static uchar obuff[BLKSIZE]; - bno = atl / (BLKSIZE/2); - off = (atl<<1) & (BLKSIZE-1) & ~03; + bno = atl / (BLKSIZE/sizeof(Rune)); + off = (atl*sizeof(Rune)) & (BLKSIZE-1) & ~03; if(bno >= NBLK) { lastc = '\n'; error(T); @@ -1264,7 +1264,7 @@ compsub(void) if(c == '\\') { c = getchr(); *p++ = ESCFLG; - if(p >= &rhsbuf[LBSIZE/2]) + if(p >= &rhsbuf[LBSIZE/sizeof(Rune)]) error(Q); } else if(c == '\n' && (!globp || !globp[0])) { @@ -1275,7 +1275,7 @@ compsub(void) if(c == seof) break; *p++ = c; - if(p >= &rhsbuf[LBSIZE/2]) + if(p >= &rhsbuf[LBSIZE/sizeof(Rune)]) error(Q); } *p = 0; |