Commit 62c8917f authored by R. Tyler Croy's avatar R. Tyler Croy
Browse files

Make libev adapter functions static to fix linking

This will allow two different compilation units to include libev.h
and link together
parent 0f2e899c
#ifndef __HIREDIS_LIBEV_H__
#define __HIREDIS_LIBEV_H__
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <ev.h> #include <ev.h>
...@@ -11,7 +13,7 @@ typedef struct redisLibevEvents { ...@@ -11,7 +13,7 @@ typedef struct redisLibevEvents {
ev_io rev, wev; ev_io rev, wev;
} redisLibevEvents; } redisLibevEvents;
void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) { static void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) {
#if EV_MULTIPLICITY #if EV_MULTIPLICITY
((void)loop); ((void)loop);
#endif #endif
...@@ -21,7 +23,7 @@ void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) { ...@@ -21,7 +23,7 @@ void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) {
redisAsyncHandleRead(e->context); redisAsyncHandleRead(e->context);
} }
void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) { static void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) {
#if EV_MULTIPLICITY #if EV_MULTIPLICITY
((void)loop); ((void)loop);
#endif #endif
...@@ -31,7 +33,7 @@ void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) { ...@@ -31,7 +33,7 @@ void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) {
redisAsyncHandleWrite(e->context); redisAsyncHandleWrite(e->context);
} }
void redisLibevAddRead(void *privdata) { static void redisLibevAddRead(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata; redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop; struct ev_loop *loop = e->loop;
((void)loop); ((void)loop);
...@@ -41,7 +43,7 @@ void redisLibevAddRead(void *privdata) { ...@@ -41,7 +43,7 @@ void redisLibevAddRead(void *privdata) {
} }
} }
void redisLibevDelRead(void *privdata) { static void redisLibevDelRead(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata; redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop; struct ev_loop *loop = e->loop;
((void)loop); ((void)loop);
...@@ -51,7 +53,7 @@ void redisLibevDelRead(void *privdata) { ...@@ -51,7 +53,7 @@ void redisLibevDelRead(void *privdata) {
} }
} }
void redisLibevAddWrite(void *privdata) { static void redisLibevAddWrite(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata; redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop; struct ev_loop *loop = e->loop;
((void)loop); ((void)loop);
...@@ -61,7 +63,7 @@ void redisLibevAddWrite(void *privdata) { ...@@ -61,7 +63,7 @@ void redisLibevAddWrite(void *privdata) {
} }
} }
void redisLibevDelWrite(void *privdata) { static void redisLibevDelWrite(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata; redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop; struct ev_loop *loop = e->loop;
((void)loop); ((void)loop);
...@@ -71,14 +73,14 @@ void redisLibevDelWrite(void *privdata) { ...@@ -71,14 +73,14 @@ void redisLibevDelWrite(void *privdata) {
} }
} }
void redisLibevCleanup(void *privdata) { static void redisLibevCleanup(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata; redisLibevEvents *e = (redisLibevEvents*)privdata;
redisLibevDelRead(privdata); redisLibevDelRead(privdata);
redisLibevDelWrite(privdata); redisLibevDelWrite(privdata);
free(e); free(e);
} }
int redisLibevAttach(EV_P_ redisAsyncContext *ac) { static int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
redisContext *c = &(ac->c); redisContext *c = &(ac->c);
redisLibevEvents *e; redisLibevEvents *e;
...@@ -112,3 +114,4 @@ int redisLibevAttach(EV_P_ redisAsyncContext *ac) { ...@@ -112,3 +114,4 @@ int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
return REDIS_OK; return REDIS_OK;
} }
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment