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
1e7f5ae6
Commit
1e7f5ae6
authored
Oct 30, 2010
by
Pieter Noordhuis
Browse files
Rename struct
parent
0f745d1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
hiredis.c
View file @
1e7f5ae6
...
...
@@ -60,7 +60,7 @@ static void *createNilObject(redisReadTask *task);
static
void
redisSetReplyReaderError
(
redisReader
*
r
,
sds
err
);
/* Default set of functions to build the reply. */
static
redisReplyFunctions
defaultFunctions
=
{
static
redisReply
Object
Functions
defaultFunctions
=
{
createStringObject
,
createArrayObject
,
createIntegerObject
,
...
...
@@ -339,7 +339,7 @@ static int processItem(redisReader *r) {
}
}
void
*
redisReplyReaderCreate
(
redisReplyFunctions
*
fn
)
{
void
*
redisReplyReaderCreate
(
redisReply
Object
Functions
*
fn
)
{
redisReader
*
r
=
calloc
(
sizeof
(
redisReader
),
1
);
r
->
error
=
NULL
;
r
->
fn
=
fn
==
NULL
?
&
defaultFunctions
:
fn
;
...
...
@@ -574,7 +574,7 @@ static int redisContextConnect(redisContext *c, const char *ip, int port) {
return
REDIS_OK
;
}
static
redisContext
*
redisContextInit
(
redisReplyFunctions
*
fn
)
{
static
redisContext
*
redisContextInit
(
redisReply
Object
Functions
*
fn
)
{
redisContext
*
c
=
calloc
(
sizeof
(
redisContext
),
1
);
c
->
error
=
NULL
;
c
->
obuf
=
sdsempty
();
...
...
@@ -629,7 +629,7 @@ void redisFree(redisContext *c) {
/* Connect to a Redis instance. On error the field error in the returned
* context will be set to the return value of the error function.
* When no set of reply functions is given, the default set will be used. */
redisContext
*
redisConnect
(
const
char
*
ip
,
int
port
,
redisReplyFunctions
*
fn
)
{
redisContext
*
redisConnect
(
const
char
*
ip
,
int
port
,
redisReply
Object
Functions
*
fn
)
{
redisContext
*
c
=
redisContextInit
(
fn
);
c
->
flags
|=
REDIS_BLOCK
;
c
->
flags
|=
REDIS_CONNECTED
;
...
...
@@ -637,7 +637,7 @@ redisContext *redisConnect(const char *ip, int port, redisReplyFunctions *fn) {
return
c
;
}
redisContext
*
redisConnectNonBlock
(
const
char
*
ip
,
int
port
,
redisReplyFunctions
*
fn
)
{
redisContext
*
redisConnectNonBlock
(
const
char
*
ip
,
int
port
,
redisReply
Object
Functions
*
fn
)
{
redisContext
*
c
=
redisContextInit
(
fn
);
c
->
flags
&=
~
REDIS_BLOCK
;
c
->
flags
|=
REDIS_CONNECTED
;
...
...
hiredis.h
View file @
1e7f5ae6
...
...
@@ -72,7 +72,7 @@ typedef struct redisReplyObjectFunctions {
void
*
(
*
createInteger
)(
redisReadTask
*
,
long
long
);
void
*
(
*
createNil
)(
redisReadTask
*
);
void
(
*
freeObject
)(
void
*
);
}
redisReplyFunctions
;
}
redisReply
Object
Functions
;
struct
redisContext
;
/* need forward declaration of redisContext */
...
...
@@ -101,7 +101,7 @@ typedef struct redisContext {
sds
obuf
;
/* Write buffer */
/* Function set for reply buildup and reply reader */
redisReplyFunctions
*
fn
;
redisReply
Object
Functions
*
fn
;
void
*
reader
;
/* Non-reply callbacks */
...
...
@@ -116,15 +116,15 @@ typedef struct redisContext {
}
redisContext
;
void
freeReplyObject
(
void
*
reply
);
void
*
redisReplyReaderCreate
(
redisReplyFunctions
*
fn
);
void
*
redisReplyReaderCreate
(
redisReply
Object
Functions
*
fn
);
void
*
redisReplyReaderGetObject
(
void
*
reader
);
char
*
redisReplyReaderGetError
(
void
*
reader
);
void
redisReplyReaderFree
(
void
*
ptr
);
void
redisReplyReaderFeed
(
void
*
reader
,
char
*
buf
,
int
len
);
int
redisReplyReaderGetReply
(
void
*
reader
,
void
**
reply
);
redisContext
*
redisConnect
(
const
char
*
ip
,
int
port
,
redisReplyFunctions
*
fn
);
redisContext
*
redisConnectNonBlock
(
const
char
*
ip
,
int
port
,
redisReplyFunctions
*
fn
);
redisContext
*
redisConnect
(
const
char
*
ip
,
int
port
,
redisReply
Object
Functions
*
fn
);
redisContext
*
redisConnectNonBlock
(
const
char
*
ip
,
int
port
,
redisReply
Object
Functions
*
fn
);
void
redisDisconnect
(
redisContext
*
c
);
void
redisFree
(
redisContext
*
c
);
int
redisBufferRead
(
redisContext
*
c
);
...
...
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