1
0
mirror of https://github.com/fluencelabs/redis synced 2025-04-03 00:01:04 +00:00

Merge branch 'unstable' into limits

This commit is contained in:
antirez 2012-01-25 10:41:25 +01:00
commit c69ad1f24e

@ -56,32 +56,30 @@ aeEventLoop *aeCreateEventLoop(int setsize) {
aeEventLoop *eventLoop; aeEventLoop *eventLoop;
int i; int i;
if ((eventLoop = zmalloc(sizeof(*eventLoop))) == NULL) return NULL; if ((eventLoop = zmalloc(sizeof(*eventLoop))) == NULL) goto err;
eventLoop->events = NULL;
eventLoop->fired = NULL;
eventLoop->events = zmalloc(sizeof(aeFileEvent)*setsize); eventLoop->events = zmalloc(sizeof(aeFileEvent)*setsize);
eventLoop->fired = zmalloc(sizeof(aeFiredEvent)*setsize); eventLoop->fired = zmalloc(sizeof(aeFiredEvent)*setsize);
if (eventLoop->events == NULL || eventLoop->fired == NULL) { if (eventLoop->events == NULL || eventLoop->fired == NULL) goto err;
zfree(eventLoop->events);
zfree(eventLoop->fired);
zfree(eventLoop);
return NULL;
}
eventLoop->setsize = setsize; eventLoop->setsize = setsize;
eventLoop->timeEventHead = NULL; eventLoop->timeEventHead = NULL;
eventLoop->timeEventNextId = 0; eventLoop->timeEventNextId = 0;
eventLoop->stop = 0; eventLoop->stop = 0;
eventLoop->maxfd = -1; eventLoop->maxfd = -1;
eventLoop->beforesleep = NULL; eventLoop->beforesleep = NULL;
if (aeApiCreate(eventLoop) == -1) { if (aeApiCreate(eventLoop) == -1) goto err;
zfree(eventLoop);
return NULL;
}
/* Events with mask == AE_NONE are not set. So let's initialize the /* Events with mask == AE_NONE are not set. So let's initialize the
* vector with it. */ * vector with it. */
for (i = 0; i < setsize; i++) for (i = 0; i < setsize; i++)
eventLoop->events[i].mask = AE_NONE; eventLoop->events[i].mask = AE_NONE;
return eventLoop; return eventLoop;
err:
if (eventLoop) {
zfree(eventLoop->events);
zfree(eventLoop->fired);
zfree(eventLoop);
}
return NULL;
} }
void aeDeleteEventLoop(aeEventLoop *eventLoop) { void aeDeleteEventLoop(aeEventLoop *eventLoop) {