ss_string_free(3) - Linux man page
Name
ss_string_free, ss_string_gc_free - frees allocated memory forss_string objects
Synopsis
#include <sstrings2.h>Linking with -lsstrings2
char *ss_string_free(ss_string *string, int free_cstring);
void ss_string_gc_free(const char *str);
Description
ss_string_free frees the allocated memory of string (a ss_string object) that has been initialized with ss_string_new. If free_cstring is a non-0 number then the allocated memory of the C-string is freed, too. Otherwise the C-string is not freed and ss_string_free returns a pointer to the C-string. In that case the C-String has to be freed using ss_string_gc_free.ss_string_gc_free frees the allocated space of the C-String saved in a ss_string object. This function should be used if ss_string_free is called with a non-0 parameter for free_cstring. If the garbage collector is disabled then you can use free(3) as well.
Returning value
ss_string_free returns a pointer to the C-String if free_cstring has a non-0 value, NULL otherwiseExample
#include <sstrings2.h>
int main(void)
{
ss_string *str;
char *tmp;
str = ss_string_new("Hello");
if(!str)
return 1;
...
/* first option */
ss_string_free(str, 1);
/* second option */
tmp = ss_string_free(str, 0);
do_something_with(str);
ss_free_gc_free(str);
return 0;
}