libventi: import changes from plan 9
R=rsc CC=plan9port.codebot http://codereview.appspot.com/4530100
This commit is contained in:
parent
cbc99e3e52
commit
f7cca88267
1 changed files with 3 additions and 4 deletions
|
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue