Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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 {
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
;
}
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