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.
This commit is contained in:
Tomas Carnecky 2008-08-04 23:26:00 +03:00 committed by Daniel Stone
parent 5532d63488
commit 277a74bcbb
3 changed files with 3 additions and 6 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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;