[PATCH 1/3] os: Reshuffle the connection translation ifdefs
Keith Packard
keithp at keithp.com
Sat Jan 23 23:49:45 PST 2010
On Mon, 14 Dec 2009 15:19:47 -0500, Adam Jackson <ajax at redhat.com> wrote:
> Use the wrapper functions consistently instead of hardcoding unix
> knowledge everywhere directly.
I like the general plan, but this looks quite broken to me as it appears
to not include the index within the fds_bits array in the computation of
the appropriate client translation id.
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
> os/WaitFor.c | 3 +--
> os/connection.c | 44 ++++++++++++++++++++------------------------
> os/io.c | 2 +-
> os/osdep.h | 6 +-----
> 4 files changed, 23 insertions(+), 32 deletions(-)
>
> diff --git a/os/WaitFor.c b/os/WaitFor.c
> index dfe85e5..7d10183 100644
> --- a/os/WaitFor.c
> +++ b/os/WaitFor.c
> @@ -338,8 +338,7 @@ WaitForSomething(int *pClientsReady)
> int client_priority, client_index;
>
> curclient = mffs (clientsReadable.fds_bits[i]) - 1;
> - client_index = /* raphael: modified */
> - ConnectionTranslation[curclient + (i * (sizeof(fd_mask) * 8))];
> + client_index = GetConnectionTranslation(curclient);
Perhaps curclient = mffs() - 1 + (i * sizeof (fd_mask) * 8)?
> void ClearConnectionTranslation(void)
> {
> +#ifndef WIN32
> + for (i=0; i<MaxClients; i++) ConnectionTranslation[i] = 0;
memset please
> index = ffs(mask) - 1;
> mask &= ~lowbit(mask);
> - if ((index = ConnectionTranslation[(base * (sizeof(fd_mask)*8)) + index]) == 0)
> + if ((index = GetConnectionTranslation(index)) == 0)
Misses 'base' here too.
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20100124/a5b3ed3d/attachment.pgp
More information about the xorg-devel
mailing list