Dynamically allocates a ‘Autostr’ and initialises it to be the empty string. It returns a pointer to the allocated ‘Autostr’, or a null pointer if none could be allocated.
Finalises the internal data structures of astr, and then frees it.
Behaves like ‘astr_create’ except that the contents of the new string are set to a copy of s immediately after initialisation.
Destroys any number of strings at once. Any number of ‘Autostr *’ arguments may be passed following the named argument astr. The last argument should be ‘(Autostr *) 0’, so that the library knows when to stop.1 As an example, the following section of code:
astr_destroy_all (str1, str2, str3, str4, (Autostr *) 0);is exactly equivalent to the following:
astr_destroy (str1); astr_destroy (str2); astr_destroy (str3); astr_destroy (str4);
[1] Note that passing a null pointer of type ‘Autostr *’ is a requirement of the C language. If you merely use a constant zero, expect your code to fail on 64-bit machines and on some word-addressed machines.