summaryrefslogtreecommitdiff
path: root/adapters/ae.h
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/ae.h')
-rw-r--r--adapters/ae.h74
1 files changed, 37 insertions, 37 deletions
diff --git a/adapters/ae.h b/adapters/ae.h
index 44db8ee..1edcd0e 100644
--- a/adapters/ae.h
+++ b/adapters/ae.h
@@ -9,45 +9,45 @@
*
*/
-#ifndef __HIREDIS_AE_H__
-#define __HIREDIS_AE_H__
+#ifndef __HIREDICT_AE_H__
+#define __HIREDICT_AE_H__
#include <sys/types.h>
#include <ae.h>
#include "../hiredict.h"
#include "../async.h"
-typedef struct redisAeEvents {
- redisAsyncContext *context;
+typedef struct redictAeEvents {
+ redictAsyncContext *context;
aeEventLoop *loop;
int fd;
int reading, writing;
-} redisAeEvents;
+} redictAeEvents;
-static void redisAeReadEvent(aeEventLoop *el, int fd, void *privdata, int mask) {
+static void redictAeReadEvent(aeEventLoop *el, int fd, void *privdata, int mask) {
((void)el); ((void)fd); ((void)mask);
- redisAeEvents *e = (redisAeEvents*)privdata;
- redisAsyncHandleRead(e->context);
+ redictAeEvents *e = (redictAeEvents*)privdata;
+ redictAsyncHandleRead(e->context);
}
-static void redisAeWriteEvent(aeEventLoop *el, int fd, void *privdata, int mask) {
+static void redictAeWriteEvent(aeEventLoop *el, int fd, void *privdata, int mask) {
((void)el); ((void)fd); ((void)mask);
- redisAeEvents *e = (redisAeEvents*)privdata;
- redisAsyncHandleWrite(e->context);
+ redictAeEvents *e = (redictAeEvents*)privdata;
+ redictAsyncHandleWrite(e->context);
}
-static void redisAeAddRead(void *privdata) {
- redisAeEvents *e = (redisAeEvents*)privdata;
+static void redictAeAddRead(void *privdata) {
+ redictAeEvents *e = (redictAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (!e->reading) {
e->reading = 1;
- aeCreateFileEvent(loop,e->fd,AE_READABLE,redisAeReadEvent,e);
+ aeCreateFileEvent(loop,e->fd,AE_READABLE,redictAeReadEvent,e);
}
}
-static void redisAeDelRead(void *privdata) {
- redisAeEvents *e = (redisAeEvents*)privdata;
+static void redictAeDelRead(void *privdata) {
+ redictAeEvents *e = (redictAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (e->reading) {
e->reading = 0;
@@ -55,17 +55,17 @@ static void redisAeDelRead(void *privdata) {
}
}
-static void redisAeAddWrite(void *privdata) {
- redisAeEvents *e = (redisAeEvents*)privdata;
+static void redictAeAddWrite(void *privdata) {
+ redictAeEvents *e = (redictAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (!e->writing) {
e->writing = 1;
- aeCreateFileEvent(loop,e->fd,AE_WRITABLE,redisAeWriteEvent,e);
+ aeCreateFileEvent(loop,e->fd,AE_WRITABLE,redictAeWriteEvent,e);
}
}
-static void redisAeDelWrite(void *privdata) {
- redisAeEvents *e = (redisAeEvents*)privdata;
+static void redictAeDelWrite(void *privdata) {
+ redictAeEvents *e = (redictAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (e->writing) {
e->writing = 0;
@@ -73,25 +73,25 @@ static void redisAeDelWrite(void *privdata) {
}
}
-static void redisAeCleanup(void *privdata) {
- redisAeEvents *e = (redisAeEvents*)privdata;
- redisAeDelRead(privdata);
- redisAeDelWrite(privdata);
+static void redictAeCleanup(void *privdata) {
+ redictAeEvents *e = (redictAeEvents*)privdata;
+ redictAeDelRead(privdata);
+ redictAeDelWrite(privdata);
hi_free(e);
}
-static int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) {
- redisContext *c = &(ac->c);
- redisAeEvents *e;
+static int redictAeAttach(aeEventLoop *loop, redictAsyncContext *ac) {
+ redictContext *c = &(ac->c);
+ redictAeEvents *e;
/* Nothing should be attached when something is already attached */
if (ac->ev.data != NULL)
- return REDIS_ERR;
+ return REDICT_ERR;
/* Create container for context and r/w events */
- e = (redisAeEvents*)hi_malloc(sizeof(*e));
+ e = (redictAeEvents*)hi_malloc(sizeof(*e));
if (e == NULL)
- return REDIS_ERR;
+ return REDICT_ERR;
e->context = ac;
e->loop = loop;
@@ -99,13 +99,13 @@ static int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) {
e->reading = e->writing = 0;
/* Register functions to start/stop listening for events */
- ac->ev.addRead = redisAeAddRead;
- ac->ev.delRead = redisAeDelRead;
- ac->ev.addWrite = redisAeAddWrite;
- ac->ev.delWrite = redisAeDelWrite;
- ac->ev.cleanup = redisAeCleanup;
+ ac->ev.addRead = redictAeAddRead;
+ ac->ev.delRead = redictAeDelRead;
+ ac->ev.addWrite = redictAeAddWrite;
+ ac->ev.delWrite = redictAeDelWrite;
+ ac->ev.cleanup = redictAeCleanup;
ac->ev.data = e;
- return REDIS_OK;
+ return REDICT_OK;
}
#endif