Commit 9a753b42 authored by Matt Stancliff's avatar Matt Stancliff
Browse files

Add API to free hiredis (sds) formattings

External callers may not know about sdsfree, so let's
give them an easy way to know how to free their sds result.
parent 1b392eb7
...@@ -984,6 +984,10 @@ int redisFormatSdsCommandArgv(sds *target, int argc, const char **argv, ...@@ -984,6 +984,10 @@ int redisFormatSdsCommandArgv(sds *target, int argc, const char **argv,
return totlen; return totlen;
} }
void redisFreeSdsCommand(sds cmd) {
sdsfree(cmd);
}
/* Format a command according to the Redis protocol. This function takes the /* Format a command according to the Redis protocol. This function takes the
* number of arguments, an array with arguments and an array with their * number of arguments, an array with arguments and an array with their
* lengths. If the latter is set to NULL, strlen will be used to compute the * lengths. If the latter is set to NULL, strlen will be used to compute the
......
...@@ -171,6 +171,7 @@ int redisFormatCommand(char **target, const char *format, ...); ...@@ -171,6 +171,7 @@ int redisFormatCommand(char **target, const char *format, ...);
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen); int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
int redisFormatSdsCommandArgv(sds *target, int argc, const char ** argv, const size_t *argvlen); int redisFormatSdsCommandArgv(sds *target, int argc, const char ** argv, const size_t *argvlen);
void redisFreeCommand(char *cmd); void redisFreeCommand(char *cmd);
void redisFreeSdsCommand(sds cmd);
/* Context for a connection to Redis */ /* Context for a connection to Redis */
typedef struct redisContext { typedef struct redisContext {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment