MCPcopy Create free account
hub / github.com/antirez/botlib / sdscatprintf

Function sdscatprintf

sds.c:575–582  ·  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

573 * s = sdscatprintf(sdsempty(), "... your format ...", args);
574 */
575sds sdscatprintf(sds s, const char *fmt, ...) {
576 va_list ap;
577 char *t;
578 va_start(ap, fmt);
579 t = sdscatvprintf(s,fmt,ap);
580 va_end(ap);
581 return t;
582}
583
584/* This function is similar to sdscatprintf, but much faster as it does
585 * not rely on sprintf() family functions implemented by the libc that

Callers 2

sdscatreprFunction · 0.85
sdsTestFunction · 0.85

Calls 1

sdscatvprintfFunction · 0.85

Tested by

no test coverage detected