libventi: import changes from plan 9

R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/4530100
This commit is contained in:
David du Colombier 2011-06-07 14:25:02 -04:00 committed by Russ Cox
parent cbc99e3e52
commit f7cca88267

View file

@ -54,8 +54,7 @@ vtbrk(int n)
{ {
static Lock lk; static Lock lk;
static uchar *buf; static uchar *buf;
static int nbuf; static int nbuf, nchunk;
static int nchunk;
int align, pad; int align, pad;
void *p; void *p;
@ -67,11 +66,11 @@ vtbrk(int n)
align = 4; align = 4;
lock(&lk); lock(&lk);
pad = (align - (ulong)buf) & (align-1); pad = (align - (uintptr)buf) & (align-1);
if(n + pad > nbuf) { if(n + pad > nbuf) {
buf = vtmallocz(ChunkSize); buf = vtmallocz(ChunkSize);
nbuf = ChunkSize; nbuf = ChunkSize;
pad = (align - (ulong)buf) & (align-1); pad = (align - (uintptr)buf) & (align-1);
nchunk++; nchunk++;
} }