Create a new module string object from a printf format and arguments. * The returned string must be freed with RedisModule_FreeString(), unless * automatic memory is enabled. * * The string is created using the sds formatter function sdscatvprintf(). * * The passed context 'ctx' may be NULL if necessary, see the * RedisModule_CreateString() documentation for more info. */
| 1142 | * The passed context 'ctx' may be NULL if necessary, see the |
| 1143 | * RedisModule_CreateString() documentation for more info. */ |
| 1144 | RedisModuleString *RM_CreateStringPrintf(RedisModuleCtx *ctx, const char *fmt, ...) { |
| 1145 | sds s = sdsempty(); |
| 1146 | |
| 1147 | va_list ap; |
| 1148 | va_start(ap, fmt); |
| 1149 | s = sdscatvprintf(s, fmt, ap); |
| 1150 | va_end(ap); |
| 1151 | |
| 1152 | RedisModuleString *o = createObject(OBJ_STRING, s); |
| 1153 | if (ctx != NULL) autoMemoryAdd(ctx,REDISMODULE_AM_STRING,o); |
| 1154 | |
| 1155 | return o; |
| 1156 | } |
| 1157 | |
| 1158 | |
| 1159 | /* Like RedisModule_CreatString(), but creates a string starting from a long long |
nothing calls this directly
no test coverage detected