This commit is contained in:
Jeff Epler 2020-01-08 16:36:43 -06:00
parent b3fb024301
commit f1c2dee1c0
1 changed files with 2 additions and 1 deletions

View File

@ -50,8 +50,9 @@ void vstr_init(vstr_t *vstr, size_t alloc) {
// Init the vstr so it allocs exactly enough ram to hold a null-terminated // Init the vstr so it allocs exactly enough ram to hold a null-terminated
// string of the given length, and set the length. // string of the given length, and set the length.
void vstr_init_len(vstr_t *vstr, size_t len) { void vstr_init_len(vstr_t *vstr, size_t len) {
if(len == SIZE_MAX) if(len == SIZE_MAX) {
m_malloc_fail(len); m_malloc_fail(len);
}
vstr_init(vstr, len + 1); vstr_init(vstr, len + 1);
vstr->len = len; vstr->len = len;
} }