MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sdscatprintf

Function sdscatprintf

app/redis-6.2.6/src/sds.c:614–621  ·  view source on GitHub ↗

Append to the sds string 's' a string obtained using printf-alike format * specifier. * * After the call, the modified sds string is no longer valid and all the * references must be substituted with the new pointer returned by the call. * * Example: * * s = sdsnew("Sum is: "); * s = sdscatprintf(s,"%d+%d = %d",a,b,a+b). * * Often you need to create a string from scratch with the printf-

Source from the content-addressed store, hash-verified

612 * s = sdscatprintf(sdsempty(), "... your format ...", args);
613 */
614sds sdscatprintf(sds s, const char *fmt, ...) {
615 va_list ap;
616 char *t;
617 va_start(ap, fmt);
618 t = sdscatvprintf(s,fmt,ap);
619 va_end(ap);
620 return t;
621}
622
623/* This function is similar to sdscatprintf, but much faster as it does
624 * not rely on sprintf() family functions implemented by the libc that

Calls 1

sdscatvprintfFunction · 0.85

Tested by

no test coverage detected