Commit f0a75950 authored by Mark Nunberg's avatar Mark Nunberg
Browse files

libevent: call destroy from cleanup

also, indentation fix
parent 1eb44cf0
...@@ -47,7 +47,7 @@ typedef struct redisLibeventEvents { ...@@ -47,7 +47,7 @@ typedef struct redisLibeventEvents {
} redisLibeventEvents; } redisLibeventEvents;
static void redisLibeventDestroy(redisLibeventEvents *e) { static void redisLibeventDestroy(redisLibeventEvents *e) {
free(e); free(e);
} }
static void redisLibeventHandler(int fd, short event, void *arg) { static void redisLibeventHandler(int fd, short event, void *arg) {
...@@ -56,8 +56,8 @@ static void redisLibeventHandler(int fd, short event, void *arg) { ...@@ -56,8 +56,8 @@ static void redisLibeventHandler(int fd, short event, void *arg) {
e->state |= REDIS_LIBEVENT_ENTERED; e->state |= REDIS_LIBEVENT_ENTERED;
#define CHECK_DELETED() if (e->state & REDIS_LIBEVENT_DELETED) {\ #define CHECK_DELETED() if (e->state & REDIS_LIBEVENT_DELETED) {\
redisLibeventDestroy(e);\ redisLibeventDestroy(e);\
return; \ return; \
} }
if ((event & EV_TIMEOUT) && (e->state & REDIS_LIBEVENT_DELETED) == 0) { if ((event & EV_TIMEOUT) && (e->state & REDIS_LIBEVENT_DELETED) == 0) {
...@@ -122,16 +122,16 @@ static void redisLibeventDelWrite(void *privdata) { ...@@ -122,16 +122,16 @@ static void redisLibeventDelWrite(void *privdata) {
static void redisLibeventCleanup(void *privdata) { static void redisLibeventCleanup(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata; redisLibeventEvents *e = (redisLibeventEvents*)privdata;
if (!e) { if (!e) {
return; return;
} }
event_del(e->ev); event_del(e->ev);
event_free(e->ev); event_free(e->ev);
e->ev = NULL; e->ev = NULL;
if (e->state & REDIS_LIBEVENT_ENTERED) { if (e->state & REDIS_LIBEVENT_ENTERED) {
e->state |= REDIS_LIBEVENT_DELETED; e->state |= REDIS_LIBEVENT_DELETED;
} else { } else {
free(e); redisLibeventDestroy(e);
} }
} }
......
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