1
0
mirror of https://github.com/fluencelabs/redis synced 2025-04-05 01:01:04 +00:00

build command outside while loop

This commit is contained in:
Pieter Noordhuis 2010-05-26 18:22:05 +02:00
parent 37dc9e5abb
commit a2f4f8711a

@ -252,18 +252,17 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
return 1; return 1;
} }
while(repeat--) { /* Build the command to send */
/* Build the command to send */ cmd = sdscatprintf(sdsempty(),"*%d\r\n",argc);
cmd = sdscatprintf(sdsempty(),"*%d\r\n",argc); for (j = 0; j < argc; j++) {
for (j = 0; j < argc; j++) { cmd = sdscatprintf(cmd,"$%lu\r\n",
cmd = sdscatprintf(cmd,"$%lu\r\n", (unsigned long)sdslen(argv[j]));
(unsigned long)sdslen(argv[j])); cmd = sdscatlen(cmd,argv[j],sdslen(argv[j]));
cmd = sdscatlen(cmd,argv[j],sdslen(argv[j])); cmd = sdscatlen(cmd,"\r\n",2);
cmd = sdscatlen(cmd,"\r\n",2); }
}
anetWrite(fd,cmd,sdslen(cmd));
sdsfree(cmd);
while(repeat--) {
anetWrite(fd,cmd,sdslen(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) {
} }
retval = cliReadReply(fd); retval = cliReadReply(fd);
if (retval) { if (retval) {
return retval; return retval;
} }