StrTryReduceSpace
- Macro
- August 22, 2025
Table of Contents
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)
- In
Str.Memory.c:19
:
// Test StrTryReduceSpace function
bool test_str_try_reduce_space(void) {
printf("Testing StrTryReduceSpace\n");
Str s = StrInit();
- In
Str.Memory.c:33
:
// Try to reduce space
StrTryReduceSpace(&s);
// Capacity should now be closer to the actual length