| 180 | } |
| 181 | |
| 182 | void strbuf_append_string(strbuf_t *s, const char *str) |
| 183 | { |
| 184 | int space, i; |
| 185 | |
| 186 | space = strbuf_empty_length(s); |
| 187 | |
| 188 | for (i = 0; str[i]; i++) { |
| 189 | if (space < 1) { |
| 190 | strbuf_resize(s, s->length + 1); |
| 191 | space = strbuf_empty_length(s); |
| 192 | } |
| 193 | |
| 194 | s->buf[s->length] = str[i]; |
| 195 | s->length++; |
| 196 | space--; |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /* strbuf_append_fmt() should only be used when an upper bound |
| 201 | * is known for the output string. */ |
no test coverage detected