X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/a1e97d692e3b9ed3cd6c8751a70665d832199fff..dbb27a0a90ca3800f5be1d8170e404b9e7b9bc44:/deps/hiredis/adapters/ae.h diff --git a/deps/hiredis/adapters/ae.h b/deps/hiredis/adapters/ae.h index b8b2228e..65235f80 100644 --- a/deps/hiredis/adapters/ae.h +++ b/deps/hiredis/adapters/ae.h @@ -1,3 +1,5 @@ +#ifndef __HIREDIS_AE_H__ +#define __HIREDIS_AE_H__ #include #include #include "../hiredis.h" @@ -10,21 +12,21 @@ typedef struct redisAeEvents { int reading, writing; } redisAeEvents; -void redisAeReadEvent(aeEventLoop *el, int fd, void *privdata, int mask) { +static void redisAeReadEvent(aeEventLoop *el, int fd, void *privdata, int mask) { ((void)el); ((void)fd); ((void)mask); redisAeEvents *e = (redisAeEvents*)privdata; redisAsyncHandleRead(e->context); } -void redisAeWriteEvent(aeEventLoop *el, int fd, void *privdata, int mask) { +static void redisAeWriteEvent(aeEventLoop *el, int fd, void *privdata, int mask) { ((void)el); ((void)fd); ((void)mask); redisAeEvents *e = (redisAeEvents*)privdata; redisAsyncHandleWrite(e->context); } -void redisAeAddRead(void *privdata) { +static void redisAeAddRead(void *privdata) { redisAeEvents *e = (redisAeEvents*)privdata; aeEventLoop *loop = e->loop; if (!e->reading) { @@ -33,7 +35,7 @@ void redisAeAddRead(void *privdata) { } } -void redisAeDelRead(void *privdata) { +static void redisAeDelRead(void *privdata) { redisAeEvents *e = (redisAeEvents*)privdata; aeEventLoop *loop = e->loop; if (e->reading) { @@ -42,7 +44,7 @@ void redisAeDelRead(void *privdata) { } } -void redisAeAddWrite(void *privdata) { +static void redisAeAddWrite(void *privdata) { redisAeEvents *e = (redisAeEvents*)privdata; aeEventLoop *loop = e->loop; if (!e->writing) { @@ -51,7 +53,7 @@ void redisAeAddWrite(void *privdata) { } } -void redisAeDelWrite(void *privdata) { +static void redisAeDelWrite(void *privdata) { redisAeEvents *e = (redisAeEvents*)privdata; aeEventLoop *loop = e->loop; if (e->writing) { @@ -60,19 +62,19 @@ void redisAeDelWrite(void *privdata) { } } -void redisAeCleanup(void *privdata) { +static void redisAeCleanup(void *privdata) { redisAeEvents *e = (redisAeEvents*)privdata; redisAeDelRead(privdata); redisAeDelWrite(privdata); free(e); } -int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) { +static int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) { redisContext *c = &(ac->c); redisAeEvents *e; /* Nothing should be attached when something is already attached */ - if (ac->_adapter_data != NULL) + if (ac->ev.data != NULL) return REDIS_ERR; /* Create container for context and r/w events */ @@ -83,13 +85,13 @@ int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) { e->reading = e->writing = 0; /* Register functions to start/stop listening for events */ - ac->evAddRead = redisAeAddRead; - ac->evDelRead = redisAeDelRead; - ac->evAddWrite = redisAeAddWrite; - ac->evDelWrite = redisAeDelWrite; - ac->evCleanup = redisAeCleanup; - ac->_adapter_data = e; + ac->ev.addRead = redisAeAddRead; + ac->ev.delRead = redisAeDelRead; + ac->ev.addWrite = redisAeAddWrite; + ac->ev.delWrite = redisAeDelWrite; + ac->ev.cleanup = redisAeCleanup; + ac->ev.data = e; return REDIS_OK; } - +#endif