From 0f2e899c41d0d95b2ebf708813cf5b3abfc8c353 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Fri, 20 May 2011 17:08:36 -0700 Subject: Add implied include of stdlib.h --- adapters/libev.h | 1 + 1 file changed, 1 insertion(+) diff --git a/adapters/libev.h b/adapters/libev.h index 7b2b6af..5701af4 100644 --- a/adapters/libev.h +++ b/adapters/libev.h @@ -1,3 +1,4 @@ +#include #include #include #include "../hiredis.h" -- cgit v1.2.3 From 62c8917f2f8abd492dd7a67ce77a98760ea166fe Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 27 Jun 2011 12:13:11 -0700 Subject: Make libev adapter functions static to fix linking This will allow two different compilation units to include libev.h and link together --- adapters/libev.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/adapters/libev.h b/adapters/libev.h index 5701af4..534d743 100644 --- a/adapters/libev.h +++ b/adapters/libev.h @@ -1,3 +1,5 @@ +#ifndef __HIREDIS_LIBEV_H__ +#define __HIREDIS_LIBEV_H__ #include #include #include @@ -11,7 +13,7 @@ typedef struct redisLibevEvents { ev_io rev, wev; } redisLibevEvents; -void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) { +static void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) { #if EV_MULTIPLICITY ((void)loop); #endif @@ -21,7 +23,7 @@ void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) { 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 ((void)loop); #endif @@ -31,7 +33,7 @@ void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) { redisAsyncHandleWrite(e->context); } -void redisLibevAddRead(void *privdata) { +static void redisLibevAddRead(void *privdata) { redisLibevEvents *e = (redisLibevEvents*)privdata; struct ev_loop *loop = e->loop; ((void)loop); @@ -41,7 +43,7 @@ void redisLibevAddRead(void *privdata) { } } -void redisLibevDelRead(void *privdata) { +static void redisLibevDelRead(void *privdata) { redisLibevEvents *e = (redisLibevEvents*)privdata; struct ev_loop *loop = e->loop; ((void)loop); @@ -51,7 +53,7 @@ void redisLibevDelRead(void *privdata) { } } -void redisLibevAddWrite(void *privdata) { +static void redisLibevAddWrite(void *privdata) { redisLibevEvents *e = (redisLibevEvents*)privdata; struct ev_loop *loop = e->loop; ((void)loop); @@ -61,7 +63,7 @@ void redisLibevAddWrite(void *privdata) { } } -void redisLibevDelWrite(void *privdata) { +static void redisLibevDelWrite(void *privdata) { redisLibevEvents *e = (redisLibevEvents*)privdata; struct ev_loop *loop = e->loop; ((void)loop); @@ -71,14 +73,14 @@ void redisLibevDelWrite(void *privdata) { } } -void redisLibevCleanup(void *privdata) { +static void redisLibevCleanup(void *privdata) { redisLibevEvents *e = (redisLibevEvents*)privdata; redisLibevDelRead(privdata); redisLibevDelWrite(privdata); free(e); } -int redisLibevAttach(EV_P_ redisAsyncContext *ac) { +static int redisLibevAttach(EV_P_ redisAsyncContext *ac) { redisContext *c = &(ac->c); redisLibevEvents *e; @@ -112,3 +114,4 @@ int redisLibevAttach(EV_P_ redisAsyncContext *ac) { return REDIS_OK; } +#endif -- cgit v1.2.3 From 0bf4dded315817482bdc502930549de45ed4baa3 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Mon, 27 Jun 2011 12:40:12 -0700 Subject: Convert the rest of the async adapters contain static functions for easier linking --- adapters/ae.h | 20 +++++++++++--------- adapters/libevent.h | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/adapters/ae.h b/adapters/ae.h index 85260a7..65235f8 100644 --- a/adapters/ae.h +++ b/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,14 +62,14 @@ 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; @@ -92,4 +94,4 @@ int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) { return REDIS_OK; } - +#endif diff --git a/adapters/libevent.h b/adapters/libevent.h index 2c18480..4055ec0 100644 --- a/adapters/libevent.h +++ b/adapters/libevent.h @@ -1,3 +1,5 @@ +#ifndef __HIREDIS_LIBEVENT_H__ +#define __HIREDIS_LIBEVENT_H__ #include #include "../hiredis.h" #include "../async.h" @@ -7,46 +9,46 @@ typedef struct redisLibeventEvents { struct event rev, wev; } redisLibeventEvents; -void redisLibeventReadEvent(int fd, short event, void *arg) { +static void redisLibeventReadEvent(int fd, short event, void *arg) { ((void)fd); ((void)event); redisLibeventEvents *e = (redisLibeventEvents*)arg; redisAsyncHandleRead(e->context); } -void redisLibeventWriteEvent(int fd, short event, void *arg) { +static void redisLibeventWriteEvent(int fd, short event, void *arg) { ((void)fd); ((void)event); redisLibeventEvents *e = (redisLibeventEvents*)arg; redisAsyncHandleWrite(e->context); } -void redisLibeventAddRead(void *privdata) { +static void redisLibeventAddRead(void *privdata) { redisLibeventEvents *e = (redisLibeventEvents*)privdata; event_add(&e->rev,NULL); } -void redisLibeventDelRead(void *privdata) { +static void redisLibeventDelRead(void *privdata) { redisLibeventEvents *e = (redisLibeventEvents*)privdata; event_del(&e->rev); } -void redisLibeventAddWrite(void *privdata) { +static void redisLibeventAddWrite(void *privdata) { redisLibeventEvents *e = (redisLibeventEvents*)privdata; event_add(&e->wev,NULL); } -void redisLibeventDelWrite(void *privdata) { +static void redisLibeventDelWrite(void *privdata) { redisLibeventEvents *e = (redisLibeventEvents*)privdata; event_del(&e->wev); } -void redisLibeventCleanup(void *privdata) { +static void redisLibeventCleanup(void *privdata) { redisLibeventEvents *e = (redisLibeventEvents*)privdata; event_del(&e->rev); event_del(&e->wev); free(e); } -int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) { +static int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) { redisContext *c = &(ac->c); redisLibeventEvents *e; @@ -73,3 +75,4 @@ int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) { event_base_set(base,&e->wev); return REDIS_OK; } +#endif -- cgit v1.2.3