Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

build command outside while loop

  • Loading branch information...
commit 2691b01beec7f0d7510934a784d7ea598ccc5409 1 parent 3294ef1
@pietern pietern authored committed
Showing with 9 additions and 11 deletions.
  1. +9 −11 redis-cli.c
View
20 redis-cli.c
@@ -252,18 +252,17 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
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--) {
- /* 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));
- sdsfree(cmd);
-
while (config.monitor_mode) {
cliReadSingleLineReply(fd,0);
}
@@ -277,7 +276,6 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
}
retval = cliReadReply(fd);
-
if (retval) {
return retval;
}
Please sign in to comment.
Something went wrong with that request. Please try again.