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-
| 573 | * s = sdscatprintf(sdsempty(), "... your format ...", args); |
| 574 | */ |
| 575 | sds 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 |
no test coverage detected