MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / strbuf_append_string

Function strbuf_append_string

deps/lua/src/strbuf.c:182–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182void 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. */

Callers 1

json_append_stringFunction · 0.85

Calls 2

strbuf_empty_lengthFunction · 0.85
strbuf_resizeFunction · 0.85

Tested by

no test coverage detected