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
a7a1886b
Commit
a7a1886b
authored
Aug 04, 2019
by
Yossi Gottlieb
Browse files
Initial RESP3 support [d5c54f0b].
parent
f5f855c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
read.c
View file @
a7a1886b
...
...
@@ -362,7 +362,8 @@ static int processBulkItem(redisReader *r) {
return
REDIS_ERR
;
}
static
int
processMultiBulkItem
(
redisReader
*
r
)
{
/* Process the array, map and set types. */
static
int
processAggregateItem
(
redisReader
*
r
)
{
redisReadTask
*
cur
=
&
(
r
->
rstack
[
r
->
ridx
]);
void
*
obj
;
char
*
p
;
...
...
@@ -404,10 +405,12 @@ static int processMultiBulkItem(redisReader *r) {
moveToNextTask
(
r
);
}
else
{
if
(
cur
->
type
==
REDIS_REPLY_MAP
)
elements
*=
2
;
if
(
r
->
fn
&&
r
->
fn
->
createArray
)
obj
=
r
->
fn
->
createArray
(
cur
,
elements
);
else
obj
=
(
void
*
)
REDIS_REPLY_ARRAY
;
obj
=
(
void
*
)
(
long
)
cur
->
type
;
if
(
obj
==
NULL
)
{
__redisReaderSetErrorOOM
(
r
);
...
...
@@ -461,6 +464,12 @@ static int processItem(redisReader *r) {
case
'*'
:
cur
->
type
=
REDIS_REPLY_ARRAY
;
break
;
case
'%'
:
cur
->
type
=
REDIS_REPLY_MAP
;
break
;
case
'~'
:
cur
->
type
=
REDIS_REPLY_SET
;
break
;
default:
__redisReaderSetErrorProtocolByte
(
r
,
*
p
);
return
REDIS_ERR
;
...
...
@@ -480,7 +489,9 @@ static int processItem(redisReader *r) {
case
REDIS_REPLY_STRING
:
return
processBulkItem
(
r
);
case
REDIS_REPLY_ARRAY
:
return
processMultiBulkItem
(
r
);
case
REDIS_REPLY_MAP
:
case
REDIS_REPLY_SET
:
return
processAggregateItem
(
r
);
default:
assert
(
NULL
);
return
REDIS_ERR
;
/* Avoid warning. */
...
...
read.h
View file @
a7a1886b
...
...
@@ -54,6 +54,14 @@
#define REDIS_REPLY_NIL 4
#define REDIS_REPLY_STATUS 5
#define REDIS_REPLY_ERROR 6
#define REDIS_REPLY_DOUBLE 7
#define REDIS_REPLY_BOOL 8
#define REDIS_REPLY_VERB 9
#define REDIS_REPLY_MAP 9
#define REDIS_REPLY_SET 10
#define REDIS_REPLY_ATTR 11
#define REDIS_REPLY_PUSH 12
#define REDIS_REPLY_BIGNUM 13
#define REDIS_READER_MAX_BUF (1024*16)
/* Default max unused reader buffer. */
...
...
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