* printfPQExpBuffer * Format text data under the control of fmt (an sprintf-like format string) * and insert it into str. More space is allocated to str if necessary. * This is a convenience routine that does the same thing as * resetPQExpBuffer() followed by appendPQExpBuffer(). */
| 241 | * resetPQExpBuffer() followed by appendPQExpBuffer(). |
| 242 | */ |
| 243 | void |
| 244 | printfPQExpBuffer(PQExpBuffer str, const char *fmt,...) |
| 245 | { |
| 246 | int save_errno = errno; |
| 247 | va_list args; |
| 248 | bool done; |
| 249 | |
| 250 | resetPQExpBuffer(str); |
| 251 | |
| 252 | if (PQExpBufferBroken(str)) |
| 253 | return; /* already failed */ |
| 254 | |
| 255 | /* Loop in case we have to retry after enlarging the buffer. */ |
| 256 | do |
| 257 | { |
| 258 | errno = save_errno; |
| 259 | va_start(args, fmt); |
| 260 | done = appendPQExpBufferVA(str, fmt, args); |
| 261 | va_end(args); |
| 262 | } while (!done); |
| 263 | } |
| 264 | |
| 265 | /* |
| 266 | * appendPQExpBuffer |
no test coverage detected