[PATCH:xscope 07/14] Make CS dynamically allocated
Jeremy Huddleston
jeremyhu at apple.com
Sat Sep 24 12:52:06 PDT 2011
Does this need a macro change somewhere? After this change, CS has MaxFD entries at start rather than StaticMaxFD. I haven't reviewed the context in full, but this seems wrong since it is a functional change and the comment indicates that it shouldn't be a functional change (modulo memory footprint).
On Sep 24, 2011, at 08:48, Alan Coopersmith wrote:
> We still allocate one ConnState struct for every possible FD up front
> instead of resizing as needed.
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> server.c | 2 +-
> table11.c | 3 +++
> x11.h | 2 +-
> 3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/server.c b/server.c
> index 77e77ca..a65eaee 100644
> --- a/server.c
> +++ b/server.c
> @@ -53,7 +53,7 @@
> struct TypeDef TD[MaxTypes];
> unsigned char RBf[2];
> unsigned char SBf[4];
> -struct ConnState CS[StaticMaxFD];
> +struct ConnState *CS;
>
> /* ************************************************************ */
> /* */
> diff --git a/table11.c b/table11.c
> index 56658b2..a3c4735 100644
> --- a/table11.c
> +++ b/table11.c
> @@ -107,6 +107,9 @@ static int PrintVISUALTYPE(const unsigned char *buf);
> void
> InitializeX11 (void)
> {
> + CS = calloc(MaxFD, sizeof(struct ConnState));
> + if (CS == NULL)
> + panic("unable to allocate ConnState table");
> InitReplyQ();
>
> InitBuiltInTypes();
> diff --git a/x11.h b/x11.h
> index 7303e1d..90f0e33 100644
> --- a/x11.h
> +++ b/x11.h
> @@ -508,7 +508,7 @@ struct ConnState
> long SequenceNumber;
> };
>
> -extern struct ConnState CS[StaticMaxFD];
> +extern struct ConnState *CS;
>
> typedef struct _Value {
> struct _Value *next;
> --
> 1.7.3.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list