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
redis
Commits
57c9babd
Commit
57c9babd
authored
Nov 05, 2010
by
Pieter Noordhuis
Browse files
Update hiredis
parent
abc3ff4d
Changes
3
Show whitespace changes
Inline
Side-by-side
deps/hiredis/hiredis.c
View file @
57c9babd
...
@@ -164,8 +164,17 @@ static char *readBytes(redisReader *r, unsigned int bytes) {
...
@@ -164,8 +164,17 @@ static char *readBytes(redisReader *r, unsigned int bytes) {
static
char
*
seekNewline
(
char
*
s
)
{
static
char
*
seekNewline
(
char
*
s
)
{
/* Find pointer to \r\n without strstr */
/* Find pointer to \r\n without strstr */
while
(
s
!=
NULL
&&
s
[
0
]
!=
'\r'
&&
s
[
1
]
!=
'\n'
)
while
(
s
!=
NULL
)
{
s
=
strchr
(
s
,
'\r'
);
s
=
strchr
(
s
,
'\r'
);
if
(
s
!=
NULL
)
{
if
(
s
[
1
]
==
'\n'
)
break
;
else
s
++
;
}
else
{
break
;
}
}
return
s
;
return
s
;
}
}
...
@@ -424,7 +433,7 @@ char *redisReplyReaderGetError(void *reader) {
...
@@ -424,7 +433,7 @@ char *redisReplyReaderGetError(void *reader) {
return
r
->
error
;
return
r
->
error
;
}
}
void
redisReplyReaderFeed
(
void
*
reader
,
char
*
buf
,
in
t
len
)
{
void
redisReplyReaderFeed
(
void
*
reader
,
char
*
buf
,
size_
t
len
)
{
redisReader
*
r
=
reader
;
redisReader
*
r
=
reader
;
/* Copy the provided buffer. */
/* Copy the provided buffer. */
...
...
deps/hiredis/hiredis.h
View file @
57c9babd
...
@@ -115,7 +115,7 @@ int redisReplyReaderSetReplyObjectFunctions(void *reader, redisReplyObjectFuncti
...
@@ -115,7 +115,7 @@ int redisReplyReaderSetReplyObjectFunctions(void *reader, redisReplyObjectFuncti
void
*
redisReplyReaderGetObject
(
void
*
reader
);
void
*
redisReplyReaderGetObject
(
void
*
reader
);
char
*
redisReplyReaderGetError
(
void
*
reader
);
char
*
redisReplyReaderGetError
(
void
*
reader
);
void
redisReplyReaderFree
(
void
*
ptr
);
void
redisReplyReaderFree
(
void
*
ptr
);
void
redisReplyReaderFeed
(
void
*
reader
,
char
*
buf
,
in
t
len
);
void
redisReplyReaderFeed
(
void
*
reader
,
char
*
buf
,
size_
t
len
);
int
redisReplyReaderGetReply
(
void
*
reader
,
void
**
reply
);
int
redisReplyReaderGetReply
(
void
*
reader
,
void
**
reply
);
/* Functions to format a command according to the protocol. */
/* Functions to format a command according to the protocol. */
...
...
deps/hiredis/test.c
View file @
57c9babd
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <sys/time.h>
#include <sys/time.h>
#include <assert.h>
#include <assert.h>
#include <unistd.h>
#include <unistd.h>
#include <signal.h>
#include "hiredis.h"
#include "hiredis.h"
...
@@ -219,6 +220,17 @@ static void test_reply_reader() {
...
@@ -219,6 +220,17 @@ static void test_reply_reader() {
ret
=
redisReplyReaderGetReply
(
reader
,
&
reply
);
ret
=
redisReplyReaderGetReply
(
reader
,
&
reply
);
test_cond
(
ret
==
REDIS_OK
&&
reply
==
(
void
*
)
REDIS_REPLY_STATUS
);
test_cond
(
ret
==
REDIS_OK
&&
reply
==
(
void
*
)
REDIS_REPLY_STATUS
);
redisReplyReaderFree
(
reader
);
redisReplyReaderFree
(
reader
);
test
(
"Works when a single newline (
\\
r
\\
n) covers two calls to feed: "
);
reader
=
redisReplyReaderCreate
();
redisReplyReaderSetReplyObjectFunctions
(
reader
,
NULL
);
redisReplyReaderFeed
(
reader
,(
char
*
)
"+OK
\r
"
,
4
);
ret
=
redisReplyReaderGetReply
(
reader
,
&
reply
);
assert
(
ret
==
REDIS_OK
&&
reply
==
NULL
);
redisReplyReaderFeed
(
reader
,(
char
*
)
"
\n
"
,
1
);
ret
=
redisReplyReaderGetReply
(
reader
,
&
reply
);
test_cond
(
ret
==
REDIS_OK
&&
reply
==
(
void
*
)
REDIS_REPLY_STATUS
);
redisReplyReaderFree
(
reader
);
}
}
static
void
test_throughput
()
{
static
void
test_throughput
()
{
...
...
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