StrTryReduceSpace

Table of Contents

StrTryReduceSpace

Description

Try reducing memory footprint of string. This is to be used when we know actual allocated memory for vec is large, and we won’t need it in future, so we can reduce it to whatever’s required at the moment.

Parameters

NameDirectionDescription
strin,outStr

Success

return

Failure

Does not return

Usage example (Cross-references)

    // Test StrTryReduceSpace function
    bool test_str_try_reduce_space(void) {
    printf("Testing StrTryReduceSpace\n");
    
    Str s = StrInit();
    
    // Try to reduce space
    StrTryReduceSpace(&s);
    
    // Capacity should now be closer to the actual length

Share :