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
a2f4f871
Commit
a2f4f871
authored
May 26, 2010
by
Pieter Noordhuis
Browse files
build command outside while loop
parent
37dc9e5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis-cli.c
View file @
a2f4f871
...
@@ -252,18 +252,17 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
...
@@ -252,18 +252,17 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
return
1
;
return
1
;
}
}
/* Build the command to send */
cmd
=
sdscatprintf
(
sdsempty
(),
"*%d
\r\n
"
,
argc
);
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
cmd
=
sdscatprintf
(
cmd
,
"$%lu
\r\n
"
,
(
unsigned
long
)
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
argv
[
j
],
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
"
\r\n
"
,
2
);
}
while
(
repeat
--
)
{
while
(
repeat
--
)
{
/* Build the command to send */
cmd
=
sdscatprintf
(
sdsempty
(),
"*%d
\r\n
"
,
argc
);
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
cmd
=
sdscatprintf
(
cmd
,
"$%lu
\r\n
"
,
(
unsigned
long
)
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
argv
[
j
],
sdslen
(
argv
[
j
]));
cmd
=
sdscatlen
(
cmd
,
"
\r\n
"
,
2
);
}
anetWrite
(
fd
,
cmd
,
sdslen
(
cmd
));
anetWrite
(
fd
,
cmd
,
sdslen
(
cmd
));
sdsfree
(
cmd
);
while
(
config
.
monitor_mode
)
{
while
(
config
.
monitor_mode
)
{
cliReadSingleLineReply
(
fd
,
0
);
cliReadSingleLineReply
(
fd
,
0
);
}
}
...
@@ -277,7 +276,6 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
...
@@ -277,7 +276,6 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
}
}
retval
=
cliReadReply
(
fd
);
retval
=
cliReadReply
(
fd
);
if
(
retval
)
{
if
(
retval
)
{
return
retval
;
return
retval
;
}
}
...
...
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