aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-05-21 16:20:29 +0000
committerrsc <devnull@localhost>2006-05-21 16:20:29 +0000
commit3bff492520ffc551fe1951ea6f0d806f837f05d5 (patch)
tree0965a2ed8d40fd37a201d74c3146f338e9ef2cb2 /src/libdraw
parent3167fce5ce254c0cd71891b929c324ced2fd5325 (diff)
downloadplan9port-3bff492520ffc551fe1951ea6f0d806f837f05d5.tar.gz
plan9port-3bff492520ffc551fe1951ea6f0d806f837f05d5.tar.bz2
plan9port-3bff492520ffc551fe1951ea6f0d806f837f05d5.zip
changes from plan 9
Diffstat (limited to 'src/libdraw')
-rw-r--r--src/libdraw/md-alloc.c24
-rw-r--r--src/libdraw/md-defont.c2
2 files changed, 11 insertions, 15 deletions
diff --git a/src/libdraw/md-alloc.c b/src/libdraw/md-alloc.c
index 89755ee9..b6ad61a7 100644
--- a/src/libdraw/md-alloc.c
+++ b/src/libdraw/md-alloc.c
@@ -19,7 +19,7 @@ memimagemove(void *from, void *to)
md->base = to;
/* if allocmemimage changes this must change too */
- md->bdata = (uchar*)((ulong*)md->base+2);
+ md->bdata = (uchar*)md->base+sizeof(Memdata*)+sizeof(ulong);
}
Memimage*
@@ -71,7 +71,7 @@ _allocmemimage(Rectangle r, u32int chan)
{
int d;
u32int l, nw;
- ulong *ul;
+ uchar *p;
Memdata *md;
Memimage *i;
@@ -87,25 +87,21 @@ _allocmemimage(Rectangle r, u32int chan)
return nil;
md->ref = 1;
- /*
- * 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));
+ md->base = poolalloc(imagmem, sizeof(Memdata*)+(1+nw)*sizeof(ulong));
if(md->base == nil){
free(md);
return nil;
}
- ul = (ulong*)md->base;
- ul[0] = (ulong)md;
- ul[1] = getcallerpc(&r);
+ p = (uchar*)md->base;
+ *(Memdata**)p = md;
+ p += sizeof(Memdata*);
- /* if this changes, memimagemove must change too */
- md->bdata = (uchar*)(ul+2);
+ *(ulong*)p = getcallerpc(&r);
+ p += sizeof(ulong);
+ /* if this changes, memimagemove must change too */
+ md->bdata = p;
md->allocd = 1;
i = allocmemimaged(r, chan, md, nil);
diff --git a/src/libdraw/md-defont.c b/src/libdraw/md-defont.c
index 1e9e01ed..21ea6cc0 100644
--- a/src/libdraw/md-defont.c
+++ b/src/libdraw/md-defont.c
@@ -21,7 +21,7 @@ getmemdefont(void)
* declared as char*, not u32int*.
*/
p = (char*)defontdata;
- n = (ulong)p & 3;
+ n = (uintptr)p & 3;
if(n != 0){
memmove(p+(4-n), p, sizeofdefont-n);
p += 4-n;