* appendStringInfo * * Format text data under the control of fmt (an sprintf-style format string) * and append it to whatever is already in str. More space is allocated * to str if necessary. This is sort of like a combination of sprintf and * strcat. */
| 104 | * strcat. |
| 105 | */ |
| 106 | void |
| 107 | appendStringInfo(StringInfo str, const char *fmt,...) |
| 108 | { |
| 109 | int save_errno = errno; |
| 110 | |
| 111 | for (;;) |
| 112 | { |
| 113 | va_list args; |
| 114 | int needed; |
| 115 | |
| 116 | /* Try to format the data. */ |
| 117 | errno = save_errno; |
| 118 | va_start(args, fmt); |
| 119 | needed = appendStringInfoVA(str, fmt, args); |
| 120 | va_end(args); |
| 121 | |
| 122 | if (needed == 0) |
| 123 | break; /* success */ |
| 124 | |
| 125 | /* Increase the buffer size and try again. */ |
| 126 | enlargeStringInfo(str, needed); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /* |
| 131 | * appendStringInfoVA |