[PATCH 1/3] Delete redundant scrnum field from Xvfb private screen-info struct.

Alan Coopersmith alan.coopersmith at oracle.com
Tue Apr 27 07:30:15 PDT 2010


Tiago Vignatti wrote:
> On Tue, Apr 27, 2010 at 04:17:10AM +0200, ext Jamey Sharp wrote:
>> The screen number can be inferred from the position in the vfbScreens
>> array, and it was only used in two places, so it was hardly important.
> 
> ...
> 
>> -    sprintf(pvfb->mmap_file, "%s/Xvfb_screen%d", pfbdir, pvfb->scrnum);
>> +    sprintf(pvfb->mmap_file, "%s/Xvfb_screen%d", pfbdir, (int) (pvfb - vfbScreens));
> 
> ...
> 
>> -    ErrorF("screen %d shmid %d\n", pvfb->scrnum, pvfb->shmid);
>> +    ErrorF("screen %d shmid %d\n", (int) (pvfb - vfbScreens), pvfb->shmid);
> 
> That's a really nice catch :) But hey, do we need to be verbose here? I'd
> prefer to avoid these pointer calculation, which is really bad for readability
> of code.

That could be avoided by just passing scrnum down as an argument through the
vfbAllocate* functions, since it's an argument (index) to the vfbScreenInit()
that calls vfbAllocateFramebufferMemory() in the first place.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list