summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-30 20:19:44 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-30 20:19:44 -0700
commitfafdfa0e1a54e19f11e220340df0557c794fabc6 (patch)
tree46152dbfeb0295b2e987b25fb26486a1f64d2be8
parent39bbb6265aa79c1ff3d787f5e23c8cb5f13bd6c1 (diff)
Make ReplyQ dynamically allocated
We still allocate a QueueHeader (a struct containing 2 pointers) for every possible FD, instead of allocating only as needed. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--decode11.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/decode11.c b/decode11.c
index a23fa30..f4d721c 100644
--- a/decode11.c
+++ b/decode11.c
@@ -135,19 +135,16 @@ struct QueueHeader
struct QueueEntry *Tail;
};
-static struct QueueHeader ReplyQ[StaticMaxFD];
+static struct QueueHeader *ReplyQ;
/* ************************************************************ */
void
InitReplyQ (void)
{
- short i;
- for (i = 0; i < StaticMaxFD; i++)
- {
- ReplyQ[i].Head = NULL;
- ReplyQ[i].Tail = NULL;
- }
+ ReplyQ = calloc(MaxFD, sizeof(struct QueueHeader));
+ if (ReplyQ == NULL)
+ panic("unable to allocate ReplyQ");
}
void
@@ -211,7 +208,7 @@ SequencedReplyExpected (
/* find the server associated with this client */
fd = FDPair(fd);
- if (fd < 0 || fd >= StaticMaxFD) return;
+ if (fd < 0 || fd >= MaxFD) return;
/* attach the new queue entry to the end of the queue for the Server */
if (ReplyQ[fd].Tail != NULL)