Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
redis-load
redis-stat
9 changes: 8 additions & 1 deletion hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ static redisReply *redisReadReply(int fd) {
}

/* Execute a command. This function is printf alike where
* %s a plain string such as a key, %b a bulk payload. For instance:
* %s a plain string such as a key, %b a bulk payload, %d an integer.
* For instance:
*
* redisCommand("SELECT %d", 3);
* redisCommand("GET %s", mykey);
* redisCommand("SET %s %b", mykey, somevalue, somevalue_len);
*
Expand Down Expand Up @@ -186,6 +188,7 @@ redisReply *redisCommand(int fd, char *format, ...) {
va_list ap;
size_t size;
char *arg, *c = format;
int intarg;
sds cmd = sdsempty();

/* Build the command string accordingly to protocol */
Expand All @@ -205,6 +208,10 @@ redisReply *redisCommand(int fd, char *format, ...) {
cmd = sdscatprintf(cmd,"%zu\r\n",size);
cmd = sdscatlen(cmd,arg,size);
break;
case 'd':
intarg = va_arg(ap,int);
cmd = sdscatprintf(cmd,"%d",intarg);
break;
case '%':
cmd = sdscat(cmd,"%");
break;
Expand Down
Loading