diff options
author | Tomas Carnecky <tom@dbservice.com> | 2008-08-04 23:26:00 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-08-05 01:17:32 +0300 |
commit | 277a74bcbb7d0a93c4f2e1de11daabd8c5f93ee8 (patch) | |
tree | ff926c7262d41be27ad2b76274a1be028ad588ec | |
parent | 5532d63488ec45953ff7f925cfb4f87adb3b04a0 (diff) |
Redefine clients as a fixed array
This removes yet another xalloc() each server generation. Also, I
couldn't find the corresponding xfree() so I guess that used to be a
memory leak there.
-rw-r--r-- | dix/globals.c | 2 | ||||
-rw-r--r-- | dix/main.c | 5 | ||||
-rw-r--r-- | include/dix.h | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/dix/globals.c b/dix/globals.c index d3dd33119..a9134c39a 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -78,7 +78,7 @@ PtrCtrl defaultPointerControl = { DEFAULT_PTR_THRESHOLD, 0}; -_X_EXPORT ClientPtr *clients; +_X_EXPORT ClientPtr clients[MAXCLIENTS]; _X_EXPORT ClientPtr serverClient; _X_EXPORT int currentMaxClients; /* current size of clients array */ _X_EXPORT long maxBigRequestSize = MAX_BIG_REQUEST_SIZE; diff --git a/dix/main.c b/dix/main.c index c34bc8a3c..35e59bd46 100644 --- a/dix/main.c +++ b/dix/main.c @@ -284,10 +284,7 @@ int main(int argc, char *argv[], char *envp[]) { CreateWellKnownSockets(); InitProcVectors(); - clients = (ClientPtr *)xalloc(MAXCLIENTS * sizeof(ClientPtr)); - if (!clients) - FatalError("couldn't create client array"); - for (i=1; i<MAXCLIENTS; i++) + for (i=1; i<MAXCLIENTS; i++) clients[i] = NullClient; serverClient = (ClientPtr)xalloc(sizeof(ClientRec)); if (!serverClient) diff --git a/include/dix.h b/include/dix.h index 4b8a96e57..64e3d7874 100644 --- a/include/dix.h +++ b/include/dix.h @@ -119,7 +119,7 @@ typedef struct _Client *ClientPtr; /* also in misc.h */ typedef struct _WorkQueue *WorkQueuePtr; -extern ClientPtr *clients; +extern ClientPtr clients[MAXCLIENTS]; extern ClientPtr serverClient; extern int currentMaxClients; extern char dispatchExceptionAtReset; |