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
hiredis
Commits
cb89a472
Commit
cb89a472
authored
Nov 22, 2010
by
Pieter Noordhuis
Browse files
Fix formatting literal percent characters
parent
9d9b8e1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
hiredis.c
View file @
cb89a472
...
...
@@ -564,7 +564,7 @@ int redisvFormatCommand(char **target, const char *format, va_list ap) {
interpolated
=
1
;
break
;
case
'%'
:
c
md
=
sdscat
(
c
md
,
"%"
);
c
urrent
=
sdscat
(
c
urrent
,
"%"
);
break
;
}
c
++
;
...
...
test.c
View file @
cb89a472
...
...
@@ -65,6 +65,12 @@ static void test_format_commands() {
len
==
4
+
4
+
(
3
+
2
)
+
4
+
(
3
+
2
)
+
4
+
(
0
+
2
));
free
(
cmd
);
test
(
"Format command with literal %%: "
);
len
=
redisFormatCommand
(
&
cmd
,
"SET %% %%"
);
test_cond
(
strncmp
(
cmd
,
"*3
\r\n
$3
\r\n
SET
\r\n
$1
\r\n
%
\r\n
$1
\r\n
%
\r\n
"
,
len
)
==
0
&&
len
==
4
+
4
+
(
3
+
2
)
+
4
+
(
1
+
2
)
+
4
+
(
1
+
2
));
free
(
cmd
);
const
char
*
argv
[
3
];
argv
[
0
]
=
"SET"
;
argv
[
1
]
=
"foo"
;
...
...
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