Skip to content
StrTryReduceSpace

StrTryReduceSpace

Description

Shrink the string’s allocated capacity back to its current length. Use when previous growth left a large unused tail. See VecTryReduceSpace for the full SUCCESS/FAILURE contract.

Usage example (Cross-references)

Usage examples (Cross-references)
    // Test StrTryReduceSpace function
    bool test_str_try_reduce_space(void) {
        WriteFmt("Testing StrTryReduceSpace\n");
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        // Try to reduce space
        StrTryReduceSpace(&s);
    
        // Capacity should now be closer to the actual length
Last updated on