Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2005/1223/3

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


64-bit safe.
 [rsc] --rw-rw-r-- M 777458 glenda sys 3332 Dec 23 22:25 sys/src/libmemdraw/alloc.c
	/n/sourcesdump/2005/1223/plan9/sys/src/libmemdraw/alloc.c:17,23 - 
	/n/sourcesdump/2005/1224/plan9/sys/src/libmemdraw/alloc.c:17,23
	  	md->base = to;
	  
	  	/* if allocmemimage changes this must change too */
	- 	md->bdata = (uchar*)&md->base[2];
	+ 	md->bdata = (uchar*)md->base+sizeof(Memdata*)+sizeof(ulong);
	  }
	  
	  Memimage*
	/n/sourcesdump/2005/1223/plan9/sys/src/libmemdraw/alloc.c:67,72 - 
	/n/sourcesdump/2005/1224/plan9/sys/src/libmemdraw/alloc.c:67,73
	  allocmemimage(Rectangle r, ulong chan)
	  {
	  	int d;
	+ 	uchar *p;
	  	ulong l, nw;
	  	Memdata *md;
	  	Memimage *i;
	/n/sourcesdump/2005/1223/plan9/sys/src/libmemdraw/alloc.c:83,100 - 
	/n/sourcesdump/2005/1224/plan9/sys/src/libmemdraw/alloc.c:84,104
	  		return nil;
	  
	  	md->ref = 1;
	- 	md->base = poolalloc(imagmem, (2+nw)*sizeof(ulong));
	+ 	md->base = poolalloc(imagmem, sizeof(Memdata*)+(1+nw)*sizeof(ulong));
	  	if(md->base == nil){
	  		free(md);
	  		return nil;
	  	}
	  
	- 	md->base[0] = (ulong)md;
	- 	md->base[1] = getcallerpc(&r);
	+ 	p = (uchar*)md->base;
	+ 	*(Memdata**)p = md;
	+ 	p += sizeof(Memdata*);
	  
	- 	/* if this changes, memimagemove must change too */
	- 	md->bdata = (uchar*)&md->base[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);
 [rsc] --rw-rw-r-- M 777458 glenda sys 3332 Dec 23 22:25 sys/src/libmemdraw/alloc.c


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].