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
d4b4a912
Commit
d4b4a912
authored
Oct 19, 2010
by
Pieter Noordhuis
Browse files
Revert
e5dd32d8
that added the const qualifier for command callbacks
parent
c8d72f7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
hiredis.c
View file @
d4b4a912
...
@@ -839,7 +839,7 @@ void *redisCommand(redisContext *c, const char *format, ...) {
...
@@ -839,7 +839,7 @@ void *redisCommand(redisContext *c, const char *format, ...) {
* Always returns NULL. In a non-blocking context this will never fail because
* Always returns NULL. In a non-blocking context this will never fail because
* this function does not do any I/O. In a blocking context this function will
* this function does not do any I/O. In a blocking context this function will
* have no effect (a callback in a blocking context makes no sense). */
* have no effect (a callback in a blocking context makes no sense). */
void
*
redisCommandWithCallback
(
redisContext
*
c
,
redisCallbackFn
*
fn
,
const
void
*
privdata
,
const
char
*
format
,
...)
{
void
*
redisCommandWithCallback
(
redisContext
*
c
,
redisCallbackFn
*
fn
,
void
*
privdata
,
const
char
*
format
,
...)
{
va_list
ap
;
va_list
ap
;
sds
cmd
;
sds
cmd
;
int
status
;
int
status
;
...
...
hiredis.h
View file @
d4b4a912
...
@@ -80,7 +80,7 @@ struct redisContext; /* need forward declaration of redisContext */
...
@@ -80,7 +80,7 @@ struct redisContext; /* need forward declaration of redisContext */
typedef
void
(
redisContextCallbackFn
)(
struct
redisContext
*
,
void
*
);
typedef
void
(
redisContextCallbackFn
)(
struct
redisContext
*
,
void
*
);
/* Reply callback prototype and container */
/* Reply callback prototype and container */
typedef
void
(
redisCallbackFn
)(
struct
redisContext
*
,
redisReply
*
,
const
void
*
);
typedef
void
(
redisCallbackFn
)(
struct
redisContext
*
,
redisReply
*
,
void
*
);
/* Callback containers */
/* Callback containers */
typedef
struct
redisContextCallback
{
typedef
struct
redisContextCallback
{
...
@@ -90,7 +90,7 @@ typedef struct redisContextCallback {
...
@@ -90,7 +90,7 @@ typedef struct redisContextCallback {
typedef
struct
redisCallback
{
typedef
struct
redisCallback
{
redisCallbackFn
*
fn
;
redisCallbackFn
*
fn
;
const
void
*
privdata
;
void
*
privdata
;
}
redisCallback
;
}
redisCallback
;
/* Context for a connection to Redis */
/* Context for a connection to Redis */
...
@@ -163,6 +163,6 @@ void *redisCommand(redisContext *c, const char *format, ...);
...
@@ -163,6 +163,6 @@ void *redisCommand(redisContext *c, const char *format, ...);
*
*
* Note: when called with a blocking context, this function will not do
* Note: when called with a blocking context, this function will not do
* anything and immediately returns NULL. */
* anything and immediately returns NULL. */
void
*
redisCommandWithCallback
(
redisContext
*
c
,
redisCallbackFn
*
fn
,
const
void
*
privdata
,
const
char
*
format
,
...);
void
*
redisCommandWithCallback
(
redisContext
*
c
,
redisCallbackFn
*
fn
,
void
*
privdata
,
const
char
*
format
,
...);
#endif
#endif
test.c
View file @
d4b4a912
...
@@ -203,7 +203,7 @@ static void __test_callback(redisContext *c, void *privdata) {
...
@@ -203,7 +203,7 @@ static void __test_callback(redisContext *c, void *privdata) {
}
}
static
long
__test_reply_callback_flags
=
0
;
static
long
__test_reply_callback_flags
=
0
;
static
void
__test_reply_callback
(
redisContext
*
c
,
redisReply
*
reply
,
const
void
*
privdata
)
{
static
void
__test_reply_callback
(
redisContext
*
c
,
redisReply
*
reply
,
void
*
privdata
)
{
((
void
)
c
);
((
void
)
c
);
/* Shift to detect execution order */
/* Shift to detect execution order */
__test_reply_callback_flags
<<=
8
;
__test_reply_callback_flags
<<=
8
;
...
...
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