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
5ba49014
Commit
5ba49014
authored
Apr 21, 2011
by
Pieter Noordhuis
Browse files
Privdata can be set directly on the struct
parent
20022189
Changes
2
Show whitespace changes
Inline
Side-by-side
hiredis.c
View file @
5ba49014
...
...
@@ -552,16 +552,6 @@ int redisReplyReaderSetReplyObjectFunctions(redisReader *r, redisReplyObjectFunc
return
REDIS_ERR
;
}
/* Set the private data field that is used in the read tasks. This argument can
* be used to curry arbitrary data to the custom reply object functions. */
int
redisReplyReaderSetPrivdata
(
redisReader
*
r
,
void
*
privdata
)
{
if
(
r
->
reply
==
NULL
)
{
r
->
privdata
=
privdata
;
return
REDIS_OK
;
}
return
REDIS_ERR
;
}
void
redisReplyReaderFree
(
redisReader
*
r
)
{
if
(
r
->
reply
!=
NULL
&&
r
->
fn
&&
r
->
fn
->
freeObject
)
r
->
fn
->
freeObject
(
r
->
reply
);
...
...
hiredis.h
View file @
5ba49014
...
...
@@ -134,14 +134,14 @@ typedef struct redisReader {
void
freeReplyObject
(
void
*
reply
);
redisReader
*
redisReplyReaderCreate
(
void
);
int
redisReplyReaderSetReplyObjectFunctions
(
redisReader
*
r
,
redisReplyObjectFunctions
*
fn
);
int
redisReplyReaderSetPrivdata
(
redisReader
*
r
,
void
*
privdata
);
void
redisReplyReaderFree
(
redisReader
*
r
);
void
redisReplyReaderFeed
(
redisReader
*
r
,
const
char
*
buf
,
size_t
len
);
int
redisReplyReaderGetReply
(
redisReader
*
r
,
void
**
reply
);
/* Backwards compatibility, can be removed on big version bump. */
#define redisReplyReaderGetObject(_r) (((redisReader*)(r))->reply)
#define redisReplyReaderGetError(_r) (((redisReader*)(r))->errstr)
#define redisReplyReaderSetPrivdata(_r, _p) (int)(((redisReader*)(_r))->privdata = (_p))
#define redisReplyReaderGetObject(_r) (((redisReader*)(_r))->reply)
#define redisReplyReaderGetError(_r) (((redisReader*)(_r))->errstr)
/* Functions to format a command according to the protocol. */
int
redisvFormatCommand
(
char
**
target
,
const
char
*
format
,
va_list
ap
);
...
...
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