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. */
| 1169 | * The passed context 'ctx' may be NULL if necessary, see the |
| 1170 | * RedisModule_CreateString() documentation for more info. */ |
| 1171 | RedisModuleString *RM_CreateStringPrintf(RedisModuleCtx *ctx, const char *fmt, ...) { |
| 1172 | sds s = sdsempty(); |
| 1173 | |
| 1174 | va_list ap; |
| 1175 | va_start(ap, fmt); |
| 1176 | s = sdscatvprintf(s, fmt, ap); |
| 1177 | va_end(ap); |
| 1178 | |
| 1179 | RedisModuleString *o = createObject(OBJ_STRING, s); |
| 1180 | if (ctx != NULL) autoMemoryAdd(ctx,REDISMODULE_AM_STRING,o); |
| 1181 | |
| 1182 | return o; |
| 1183 | } |
| 1184 | |
| 1185 | |
| 1186 | /* Like RedisModule_CreatString(), but creates a string starting from a long long |
nothing calls this directly
no test coverage detected