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
e6fb160b
Commit
e6fb160b
authored
Sep 25, 2010
by
Pieter Noordhuis
Browse files
Rename defines HIREDIS_* to REDIS_*
parent
bb668e1b
Changes
2
Show whitespace changes
Inline
Side-by-side
hiredis.c
View file @
e6fb160b
...
...
@@ -572,13 +572,13 @@ static int redisContextConnect(redisContext *c, const char *ip, int port) {
if
(
c
->
fd
==
ANET_ERR
)
{
c
->
error
=
c
->
fn
->
createError
(
err
,
strlen
(
err
));
return
HI
REDIS_ERR
;
return
REDIS_ERR
;
}
if
(
anetTcpNoDelay
(
err
,
c
->
fd
)
==
ANET_ERR
)
{
c
->
error
=
c
->
fn
->
createError
(
err
,
strlen
(
err
));
return
HI
REDIS_ERR
;
return
REDIS_ERR
;
}
return
HI
REDIS_OK
;
return
REDIS_OK
;
}
static
redisContext
*
redisContextInit
(
redisReplyFunctions
*
fn
)
{
...
...
@@ -625,16 +625,16 @@ int redisBufferRead(redisContext *c) {
/* Set error in context */
c
->
error
=
formatError
(
c
->
fn
,
"Error reading from socket: %s"
,
strerror
(
errno
));
return
HI
REDIS_ERR
;
return
REDIS_ERR
;
}
}
else
if
(
nread
==
0
)
{
c
->
error
=
formatError
(
c
->
fn
,
"Server closed the connection"
);
return
HI
REDIS_ERR
;
return
REDIS_ERR
;
}
else
{
redisReplyReaderFeed
(
c
->
reader
,
buf
,
nread
);
}
return
HI
REDIS_OK
;
return
REDIS_OK
;
}
static
void
redisPopCallback
(
redisContext
*
c
)
{
...
...
@@ -659,7 +659,7 @@ int redisProcessCallbacks(redisContext *c) {
cb
.
fn
(
c
,
reply
,
cb
.
privdata
);
redisPopCallback
(
c
);
}
return
HI
REDIS_OK
;
return
REDIS_OK
;
}
/* Use this function to try and write the entire output buffer to the
...
...
@@ -673,7 +673,7 @@ int redisBufferWrite(redisContext *c, int *done) {
/* Set error in context */
c
->
error
=
formatError
(
c
->
fn
,
"Error writing to socket: %s"
,
strerror
(
errno
));
return
HI
REDIS_ERR
;
return
REDIS_ERR
;
}
}
else
if
(
nwritten
>
0
)
{
if
(
nwritten
==
(
signed
)
sdslen
(
c
->
obuf
))
{
...
...
@@ -684,7 +684,7 @@ int redisBufferWrite(redisContext *c, int *done) {
}
}
if
(
done
!=
NULL
)
*
done
=
(
sdslen
(
c
->
obuf
)
==
0
);
return
HI
REDIS_OK
;
return
REDIS_OK
;
}
static
void
*
redisCommandWrite
(
redisContext
*
c
,
redisCallback
*
cb
,
char
*
str
,
size_t
len
)
{
...
...
@@ -695,12 +695,12 @@ static void* redisCommandWrite(redisContext *c, redisCallback *cb, char *str, si
/* Read reply immediately when the context is blocking. */
if
(
c
->
flags
&
HIREDIS_BLOCK
)
{
do
{
/* Write until done. */
if
(
redisBufferWrite
(
c
,
&
wdone
)
==
HI
REDIS_ERR
)
if
(
redisBufferWrite
(
c
,
&
wdone
)
==
REDIS_ERR
)
return
c
->
error
;
}
while
(
!
wdone
);
do
{
/* Read until there is a reply. */
if
(
redisBufferRead
(
c
)
==
HI
REDIS_ERR
)
if
(
redisBufferRead
(
c
)
==
REDIS_ERR
)
return
c
->
error
;
reply
=
redisGetReply
(
c
);
}
while
(
reply
==
NULL
);
...
...
hiredis.h
View file @
e6fb160b
...
...
@@ -30,8 +30,8 @@
#ifndef __HIREDIS_H
#define __HIREDIS_H
#define
HI
REDIS_ERR -1
#define
HI
REDIS_OK 0
#define REDIS_ERR -1
#define REDIS_OK 0
/* Connection type can be blocking or non-blocking and is set in the
* least significant bit of the flags field in redisContext. */
...
...
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