MCPcopy Index your code
hub / github.com/git/git / strbuf_setlen

Function strbuf_setlen

strbuf.h:164–173  ·  view source on GitHub ↗

* Set the length of the buffer to a given value. This function does *not* * allocate new memory, so you should not perform a `strbuf_setlen()` to a * length that is larger than `len + strbuf_avail()`. `strbuf_setlen()` is * just meant as a 'please fix invariants from this strbuf I just messed * with'. */

Source from the content-addressed store, hash-verified

162 * with'.
163 */
164static inline void strbuf_setlen(struct strbuf *sb, size_t len)
165{
166 if (len > (sb->alloc ? sb->alloc - 1 : 0))
167 BUG("strbuf_setlen() beyond buffer");
168 sb->len = len;
169 if (sb->buf != strbuf_slopbuf)
170 sb->buf[len] = '\0';
171 else
172 assert(!strbuf_slopbuf[0]);
173}
174
175/**
176 * Empty the buffer by setting the size of it to zero.

Callers 15

parse_valueFunction · 0.85
git_parse_sourceFunction · 0.85
is_git_directoryFunction · 0.85
setup_bare_git_dirFunction · 0.85
enter_repoFunction · 0.85
copy_templates_1Function · 0.85
copy_templatesFunction · 0.85
create_object_directoryFunction · 0.85
find_commonFunction · 0.85

Calls

no outgoing calls

Tested by 6

app__chunk_commandFunction · 0.68
app__slow_commandFunction · 0.68
dumpFunction · 0.68
testsuiteFunction · 0.68
sort_stdinFunction · 0.68
cmd__string_listFunction · 0.68