Skip to content
StrTryReduceSpace

StrTryReduceSpace

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

Name Direction Description
str in,out Str

Success

return

Failure

Does not return

Usage example (Cross-references)

Usage examples (Cross-references)
    
            case STR_TRY_REDUCE_SPACE : {
                StrTryReduceSpace(str);
                break;
            }
    // Test StrTryReduceSpace function
    bool test_str_try_reduce_space(void) {
        WriteFmt("Testing StrTryReduceSpace\n");
    
        Str s = StrInit();
    
        // Try to reduce space
        StrTryReduceSpace(&s);
    
        // Capacity should now be closer to the actual length
Last updated on