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
94761286
Commit
94761286
authored
Oct 19, 2010
by
Pieter Noordhuis
Browse files
Remove const qualifier from command callback in examples
parent
d4b4a912
Changes
2
Hide whitespace changes
Inline
Side-by-side
libev-example.c
View file @
94761286
...
...
@@ -4,8 +4,8 @@
#include <hiredis/libev.h>
#include <signal.h>
void
getCallback
(
redisContext
*
c
,
redisReply
*
reply
,
const
void
*
privdata
)
{
printf
(
"argv[%s]: %s
\n
"
,
(
const
char
*
)
privdata
,
reply
->
reply
);
void
getCallback
(
redisContext
*
c
,
redisReply
*
reply
,
void
*
privdata
)
{
printf
(
"argv[%s]: %s
\n
"
,
(
char
*
)
privdata
,
reply
->
reply
);
/* Disconnect after receiving the reply to GET */
redisDisconnect
(
c
);
...
...
@@ -23,7 +23,7 @@ int main (int argc, char **argv) {
if
(
c
==
NULL
)
return
1
;
redisCommand
(
c
,
"SET key %b"
,
argv
[
argc
-
1
],
strlen
(
argv
[
argc
-
1
]));
redisCommandWithCallback
(
c
,
getCallback
,
"end-1"
,
"GET key"
);
redisCommandWithCallback
(
c
,
getCallback
,
(
char
*
)
"end-1"
,
"GET key"
);
ev_loop
(
loop
,
0
);
redisFree
(
c
);
return
0
;
...
...
libevent-example.c
View file @
94761286
...
...
@@ -4,7 +4,7 @@
#include <hiredis/libevent.h>
#include <signal.h>
void
getCallback
(
redisContext
*
c
,
redisReply
*
reply
,
const
void
*
privdata
)
{
void
getCallback
(
redisContext
*
c
,
redisReply
*
reply
,
void
*
privdata
)
{
printf
(
"argv[%s]: %s
\n
"
,
(
const
char
*
)
privdata
,
reply
->
reply
);
/* Disconnect after receiving the reply to GET */
...
...
@@ -23,7 +23,7 @@ int main (int argc, char **argv) {
if
(
c
==
NULL
)
return
1
;
redisCommand
(
c
,
"SET key %b"
,
argv
[
argc
-
1
],
strlen
(
argv
[
argc
-
1
]));
redisCommandWithCallback
(
c
,
getCallback
,
"end-1"
,
"GET key"
);
redisCommandWithCallback
(
c
,
getCallback
,
(
char
*
)
"end-1"
,
"GET key"
);
event_base_dispatch
(
base
);
redisFree
(
c
);
return
0
;
...
...
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