19 string->string = calloc(1, 1);
43 if (
string != NULL && s != NULL)
46 size_t newSize =
string->length + strlen(s) + 1;
47 if (string->
string == NULL)
49 newText = calloc(1, newSize);
53 newText = realloc(string->
string, newSize);
57 newText[
string->length] =
'\0';
58 string->string = newText;
62 string->length = strlen(string->
string);
void DynamicString_Clear(DynamicString *string)
Clear a DynamicString object, releasing any allocated memory. Resets to an empty string.
void DynamicString_Initialize(DynamicString *string)
Initialize a DynamicString object to an empty string.
bool DynamicString_Set(DynamicString *string, const char *s)
Set the DynamicString object to the specified string, replacing whatever is in the DynamicString obje...
bool DynamicString_Append(DynamicString *string, const char *s)
Append the specified string to the DynamicString object.
Declaration of the DynamicString structure and supporting functions to work with dynamic strings.
Represents a string that can be grown dynamically.
char * string
The string that can grow.