changes from plan 9
This commit is contained in:
parent
3167fce5ce
commit
3bff492520
2 changed files with 11 additions and 15 deletions
|
|
@ -19,7 +19,7 @@ memimagemove(void *from, void *to)
|
||||||
md->base = to;
|
md->base = to;
|
||||||
|
|
||||||
/* if allocmemimage changes this must change too */
|
/* if allocmemimage changes this must change too */
|
||||||
md->bdata = (uchar*)((ulong*)md->base+2);
|
md->bdata = (uchar*)md->base+sizeof(Memdata*)+sizeof(ulong);
|
||||||
}
|
}
|
||||||
|
|
||||||
Memimage*
|
Memimage*
|
||||||
|
|
@ -71,7 +71,7 @@ _allocmemimage(Rectangle r, u32int chan)
|
||||||
{
|
{
|
||||||
int d;
|
int d;
|
||||||
u32int l, nw;
|
u32int l, nw;
|
||||||
ulong *ul;
|
uchar *p;
|
||||||
Memdata *md;
|
Memdata *md;
|
||||||
Memimage *i;
|
Memimage *i;
|
||||||
|
|
||||||
|
|
@ -87,25 +87,21 @@ _allocmemimage(Rectangle r, u32int chan)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
md->ref = 1;
|
md->ref = 1;
|
||||||
/*
|
md->base = poolalloc(imagmem, sizeof(Memdata*)+(1+nw)*sizeof(ulong));
|
||||||
* The first two ulongs are the md and the callerpc.
|
|
||||||
* Then nw words of data.
|
|
||||||
* The final word lets the drawing routines be a little
|
|
||||||
* sloppy about reading past the end of the block.
|
|
||||||
*/
|
|
||||||
md->base = poolalloc(imagmem, 2*sizeof(ulong)+(nw+1)*sizeof(u32int));
|
|
||||||
if(md->base == nil){
|
if(md->base == nil){
|
||||||
free(md);
|
free(md);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul = (ulong*)md->base;
|
p = (uchar*)md->base;
|
||||||
ul[0] = (ulong)md;
|
*(Memdata**)p = md;
|
||||||
ul[1] = getcallerpc(&r);
|
p += sizeof(Memdata*);
|
||||||
|
|
||||||
|
*(ulong*)p = getcallerpc(&r);
|
||||||
|
p += sizeof(ulong);
|
||||||
|
|
||||||
/* if this changes, memimagemove must change too */
|
/* if this changes, memimagemove must change too */
|
||||||
md->bdata = (uchar*)(ul+2);
|
md->bdata = p;
|
||||||
|
|
||||||
md->allocd = 1;
|
md->allocd = 1;
|
||||||
|
|
||||||
i = allocmemimaged(r, chan, md, nil);
|
i = allocmemimaged(r, chan, md, nil);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ getmemdefont(void)
|
||||||
* declared as char*, not u32int*.
|
* declared as char*, not u32int*.
|
||||||
*/
|
*/
|
||||||
p = (char*)defontdata;
|
p = (char*)defontdata;
|
||||||
n = (ulong)p & 3;
|
n = (uintptr)p & 3;
|
||||||
if(n != 0){
|
if(n != 0){
|
||||||
memmove(p+(4-n), p, sizeofdefont-n);
|
memmove(p+(4-n), p, sizeofdefont-n);
|
||||||
p += 4-n;
|
p += 4-n;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue