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
e8e30bc4
Commit
e8e30bc4
authored
Sep 17, 2019
by
antirez
Browse files
RESP3: bool and null values in RESP -> human readable conversion.
parent
f01f0c02
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scripting.c
View file @
e8e30bc4
...
...
@@ -2155,6 +2155,8 @@ char *ldbRedisProtocolToHuman_Status(sds *o, char *reply);
char
*
ldbRedisProtocolToHuman_MultiBulk
(
sds
*
o
,
char
*
reply
);
char
*
ldbRedisProtocolToHuman_Set
(
sds
*
o
,
char
*
reply
);
char
*
ldbRedisProtocolToHuman_Map
(
sds
*
o
,
char
*
reply
);
char
*
ldbRedisProtocolToHuman_Null
(
sds
*
o
,
char
*
reply
);
char
*
ldbRedisProtocolToHuman_Bool
(
sds
*
o
,
char
*
reply
);
/* Get Redis protocol from 'reply' and appends it in human readable form to
* the passed SDS string 'o'.
...
...
@@ -2171,6 +2173,8 @@ char *ldbRedisProtocolToHuman(sds *o, char *reply) {
case
'*'
:
p
=
ldbRedisProtocolToHuman_MultiBulk
(
o
,
reply
);
break
;
case
'~'
:
p
=
ldbRedisProtocolToHuman_Set
(
o
,
reply
);
break
;
case
'%'
:
p
=
ldbRedisProtocolToHuman_Map
(
o
,
reply
);
break
;
case
'_'
:
p
=
ldbRedisProtocolToHuman_Null
(
o
,
reply
);
break
;
case
'#'
:
p
=
ldbRedisProtocolToHuman_Bool
(
o
,
reply
);
break
;
}
return
p
;
}
...
...
@@ -2259,6 +2263,21 @@ char *ldbRedisProtocolToHuman_Map(sds *o, char *reply) {
return
p
;
}
char
*
ldbRedisProtocolToHuman_Null
(
sds
*
o
,
char
*
reply
)
{
char
*
p
=
strchr
(
reply
+
1
,
'\r'
);
*
o
=
sdscatlen
(
*
o
,
"(null)"
,
6
);
return
p
+
2
;
}
char
*
ldbRedisProtocolToHuman_Bool
(
sds
*
o
,
char
*
reply
)
{
char
*
p
=
strchr
(
reply
+
1
,
'\r'
);
if
(
reply
[
1
]
==
't'
)
*
o
=
sdscatlen
(
*
o
,
"#true"
,
5
);
else
*
o
=
sdscatlen
(
*
o
,
"#false"
,
6
);
return
p
+
2
;
}
/* Log a Redis reply as debugger output, in an human readable format.
* If the resulting string is longer than 'len' plus a few more chars
* used as prefix, it gets truncated. */
...
...
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