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
redis
Commits
f44e00b6
Commit
f44e00b6
authored
Nov 09, 2018
by
antirez
Browse files
RESP3: Use new API and types in t_hash.c.
parent
b5076547
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_hash.c
View file @
f44e00b6
...
@@ -693,7 +693,7 @@ void hmgetCommand(client *c) {
...
@@ -693,7 +693,7 @@ void hmgetCommand(client *c) {
return
;
return
;
}
}
addReplyM
ultiBulk
Len
(
c
,
c
->
argc
-
2
);
addReplyM
ap
Len
(
c
,
c
->
argc
-
2
);
for
(
i
=
2
;
i
<
c
->
argc
;
i
++
)
{
for
(
i
=
2
;
i
<
c
->
argc
;
i
++
)
{
addHashFieldToReply
(
c
,
o
,
c
->
argv
[
i
]
->
ptr
);
addHashFieldToReply
(
c
,
o
,
c
->
argv
[
i
]
->
ptr
);
}
}
...
@@ -766,17 +766,19 @@ static void addHashIteratorCursorToReply(client *c, hashTypeIterator *hi, int wh
...
@@ -766,17 +766,19 @@ static void addHashIteratorCursorToReply(client *c, hashTypeIterator *hi, int wh
void
genericHgetallCommand
(
client
*
c
,
int
flags
)
{
void
genericHgetallCommand
(
client
*
c
,
int
flags
)
{
robj
*
o
;
robj
*
o
;
hashTypeIterator
*
hi
;
hashTypeIterator
*
hi
;
int
multiplier
=
0
;
int
length
,
count
=
0
;
int
length
,
count
=
0
;
if
((
o
=
lookupKeyReadOrReply
(
c
,
c
->
argv
[
1
],
shared
.
emptymultibulk
))
==
NULL
if
((
o
=
lookupKeyReadOrReply
(
c
,
c
->
argv
[
1
],
shared
.
emptymultibulk
))
==
NULL
||
checkType
(
c
,
o
,
OBJ_HASH
))
return
;
||
checkType
(
c
,
o
,
OBJ_HASH
))
return
;
if
(
flags
&
OBJ_HASH_KEY
)
multiplier
++
;
/* We return a map if the user requested keys and values, like in the
if
(
flags
&
OBJ_HASH_VALUE
)
multiplier
++
;
* HGETALL case. Otherwise to use a flat array makes more sense. */
length
=
hashTypeLength
(
o
);
length
=
hashTypeLength
(
o
)
*
multiplier
;
if
(
flags
&
OBJ_HASH_KEY
&&
flags
&
OBJ_HASH_VALUE
)
{
addReplyMultiBulkLen
(
c
,
length
);
addReplyMapLen
(
c
,
length
);
}
else
{
addReplyArrayLen
(
c
,
length
);
}
hi
=
hashTypeInitIterator
(
o
);
hi
=
hashTypeInitIterator
(
o
);
while
(
hashTypeNext
(
hi
)
!=
C_ERR
)
{
while
(
hashTypeNext
(
hi
)
!=
C_ERR
)
{
...
...
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