Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
hiredis
Commits
4f4d1ed7
Commit
4f4d1ed7
authored
Nov 22, 2010
by
Pieter Noordhuis
Browse files
Explicit casts for the libev adapter
parent
0d925bb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
adapters/libev.h
View file @
4f4d1ed7
...
@@ -12,18 +12,18 @@ typedef struct redisLibevEvents {
...
@@ -12,18 +12,18 @@ typedef struct redisLibevEvents {
void
redisLibevReadEvent
(
struct
ev_loop
*
loop
,
ev_io
*
watcher
,
int
revents
)
{
void
redisLibevReadEvent
(
struct
ev_loop
*
loop
,
ev_io
*
watcher
,
int
revents
)
{
((
void
)
loop
);
((
void
)
revents
);
((
void
)
loop
);
((
void
)
revents
);
redisLibevEvents
*
e
=
watcher
->
data
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
watcher
->
data
;
redisAsyncHandleRead
(
e
->
context
);
redisAsyncHandleRead
(
e
->
context
);
}
}
void
redisLibevWriteEvent
(
struct
ev_loop
*
loop
,
ev_io
*
watcher
,
int
revents
)
{
void
redisLibevWriteEvent
(
struct
ev_loop
*
loop
,
ev_io
*
watcher
,
int
revents
)
{
((
void
)
loop
);
((
void
)
revents
);
((
void
)
loop
);
((
void
)
revents
);
redisLibevEvents
*
e
=
watcher
->
data
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
watcher
->
data
;
redisAsyncHandleWrite
(
e
->
context
);
redisAsyncHandleWrite
(
e
->
context
);
}
}
void
redisLibevAddRead
(
void
*
privdata
)
{
void
redisLibevAddRead
(
void
*
privdata
)
{
redisLibevEvents
*
e
=
privdata
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
privdata
;
if
(
!
e
->
reading
)
{
if
(
!
e
->
reading
)
{
e
->
reading
=
1
;
e
->
reading
=
1
;
ev_io_start
(
e
->
loop
,
&
e
->
rev
);
ev_io_start
(
e
->
loop
,
&
e
->
rev
);
...
@@ -31,7 +31,7 @@ void redisLibevAddRead(void *privdata) {
...
@@ -31,7 +31,7 @@ void redisLibevAddRead(void *privdata) {
}
}
void
redisLibevDelRead
(
void
*
privdata
)
{
void
redisLibevDelRead
(
void
*
privdata
)
{
redisLibevEvents
*
e
=
privdata
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
privdata
;
if
(
e
->
reading
)
{
if
(
e
->
reading
)
{
e
->
reading
=
0
;
e
->
reading
=
0
;
ev_io_stop
(
e
->
loop
,
&
e
->
rev
);
ev_io_stop
(
e
->
loop
,
&
e
->
rev
);
...
@@ -39,7 +39,7 @@ void redisLibevDelRead(void *privdata) {
...
@@ -39,7 +39,7 @@ void redisLibevDelRead(void *privdata) {
}
}
void
redisLibevAddWrite
(
void
*
privdata
)
{
void
redisLibevAddWrite
(
void
*
privdata
)
{
redisLibevEvents
*
e
=
privdata
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
privdata
;
if
(
!
e
->
writing
)
{
if
(
!
e
->
writing
)
{
e
->
writing
=
1
;
e
->
writing
=
1
;
ev_io_start
(
e
->
loop
,
&
e
->
wev
);
ev_io_start
(
e
->
loop
,
&
e
->
wev
);
...
@@ -47,7 +47,7 @@ void redisLibevAddWrite(void *privdata) {
...
@@ -47,7 +47,7 @@ void redisLibevAddWrite(void *privdata) {
}
}
void
redisLibevDelWrite
(
void
*
privdata
)
{
void
redisLibevDelWrite
(
void
*
privdata
)
{
redisLibevEvents
*
e
=
privdata
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
privdata
;
if
(
e
->
writing
)
{
if
(
e
->
writing
)
{
e
->
writing
=
0
;
e
->
writing
=
0
;
ev_io_stop
(
e
->
loop
,
&
e
->
wev
);
ev_io_stop
(
e
->
loop
,
&
e
->
wev
);
...
@@ -55,7 +55,7 @@ void redisLibevDelWrite(void *privdata) {
...
@@ -55,7 +55,7 @@ void redisLibevDelWrite(void *privdata) {
}
}
void
redisLibevCleanup
(
void
*
privdata
)
{
void
redisLibevCleanup
(
void
*
privdata
)
{
redisLibevEvents
*
e
=
privdata
;
redisLibevEvents
*
e
=
(
redisLibevEvents
*
)
privdata
;
redisLibevDelRead
(
privdata
);
redisLibevDelRead
(
privdata
);
redisLibevDelWrite
(
privdata
);
redisLibevDelWrite
(
privdata
);
free
(
e
);
free
(
e
);
...
@@ -70,7 +70,7 @@ int redisLibevAttach(redisAsyncContext *ac, struct ev_loop *loop) {
...
@@ -70,7 +70,7 @@ int redisLibevAttach(redisAsyncContext *ac, struct ev_loop *loop) {
return
REDIS_ERR
;
return
REDIS_ERR
;
/* Create container for context and r/w events */
/* Create container for context and r/w events */
e
=
malloc
(
sizeof
(
*
e
));
e
=
(
redisLibevEvents
*
)
malloc
(
sizeof
(
*
e
));
e
->
context
=
ac
;
e
->
context
=
ac
;
e
->
loop
=
loop
;
e
->
loop
=
loop
;
e
->
reading
=
e
->
writing
=
0
;
e
->
reading
=
e
->
writing
=
0
;
...
@@ -90,3 +90,4 @@ int redisLibevAttach(redisAsyncContext *ac, struct ev_loop *loop) {
...
@@ -90,3 +90,4 @@ int redisLibevAttach(redisAsyncContext *ac, struct ev_loop *loop) {
ev_io_init
(
&
e
->
wev
,
redisLibevWriteEvent
,
c
->
fd
,
EV_WRITE
);
ev_io_init
(
&
e
->
wev
,
redisLibevWriteEvent
,
c
->
fd
,
EV_WRITE
);
return
REDIS_OK
;
return
REDIS_OK
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment