Explicit casts for the libev adapter
This commit is contained in:
parent
0d925bb497
commit
4f4d1ed7b5
|
@ -12,18 +12,18 @@ typedef struct redisLibevEvents {
|
|||
|
||||
void redisLibevReadEvent(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||
((void)loop); ((void)revents);
|
||||
redisLibevEvents *e = watcher->data;
|
||||
redisLibevEvents *e = (redisLibevEvents*)watcher->data;
|
||||
redisAsyncHandleRead(e->context);
|
||||
}
|
||||
|
||||
void redisLibevWriteEvent(struct ev_loop *loop, ev_io *watcher, int revents) {
|
||||
((void)loop); ((void)revents);
|
||||
redisLibevEvents *e = watcher->data;
|
||||
redisLibevEvents *e = (redisLibevEvents*)watcher->data;
|
||||
redisAsyncHandleWrite(e->context);
|
||||
}
|
||||
|
||||
void redisLibevAddRead(void *privdata) {
|
||||
redisLibevEvents *e = privdata;
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
if (!e->reading) {
|
||||
e->reading = 1;
|
||||
ev_io_start(e->loop,&e->rev);
|
||||
|
@ -31,7 +31,7 @@ void redisLibevAddRead(void *privdata) {
|
|||
}
|
||||
|
||||
void redisLibevDelRead(void *privdata) {
|
||||
redisLibevEvents *e = privdata;
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
if (e->reading) {
|
||||
e->reading = 0;
|
||||
ev_io_stop(e->loop,&e->rev);
|
||||
|
@ -39,7 +39,7 @@ void redisLibevDelRead(void *privdata) {
|
|||
}
|
||||
|
||||
void redisLibevAddWrite(void *privdata) {
|
||||
redisLibevEvents *e = privdata;
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
if (!e->writing) {
|
||||
e->writing = 1;
|
||||
ev_io_start(e->loop,&e->wev);
|
||||
|
@ -47,7 +47,7 @@ void redisLibevAddWrite(void *privdata) {
|
|||
}
|
||||
|
||||
void redisLibevDelWrite(void *privdata) {
|
||||
redisLibevEvents *e = privdata;
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
if (e->writing) {
|
||||
e->writing = 0;
|
||||
ev_io_stop(e->loop,&e->wev);
|
||||
|
@ -55,7 +55,7 @@ void redisLibevDelWrite(void *privdata) {
|
|||
}
|
||||
|
||||
void redisLibevCleanup(void *privdata) {
|
||||
redisLibevEvents *e = privdata;
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
redisLibevDelRead(privdata);
|
||||
redisLibevDelWrite(privdata);
|
||||
free(e);
|
||||
|
@ -70,7 +70,7 @@ int redisLibevAttach(redisAsyncContext *ac, struct ev_loop *loop) {
|
|||
return REDIS_ERR;
|
||||
|
||||
/* Create container for context and r/w events */
|
||||
e = malloc(sizeof(*e));
|
||||
e = (redisLibevEvents*)malloc(sizeof(*e));
|
||||
e->context = ac;
|
||||
e->loop = loop;
|
||||
e->reading = e->writing = 0;
|
||||
|
@ -90,3 +90,4 @@ int redisLibevAttach(redisAsyncContext *ac, struct ev_loop *loop) {
|
|||
ev_io_init(&e->wev,redisLibevWriteEvent,c->fd,EV_WRITE);
|
||||
return REDIS_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue