| 303 | } |
| 304 | |
| 305 | SZ_PUBLIC void sz_string_init(sz_string_t *string) { |
| 306 | sz_assert_(string && "String can't be SZ_NULL."); |
| 307 | |
| 308 | // Only 8 + 1 + 1 need to be initialized. |
| 309 | string->internal.start = &string->internal.chars[0]; |
| 310 | // But for safety let's initialize the entire structure to zeros. |
| 311 | // string->internal.chars[0] = 0; |
| 312 | // string->internal.length = 0; |
| 313 | string->words[1] = 0; |
| 314 | string->words[2] = 0; |
| 315 | string->words[3] = 0; |
| 316 | } |
| 317 | |
| 318 | SZ_PUBLIC sz_ptr_t sz_string_init_length(sz_string_t *string, sz_size_t length, sz_memory_allocator_t *allocator) { |
| 319 | sz_size_t space_needed = length + 1; // space for trailing \0 |
no outgoing calls
no test coverage detected
searching dependent graphs…