/* Returns: (nullable): the character data of @string (i.e. NULL if @free_segment is TRUE)  */
gchar* g_string_free(GString *string, gboolean free_segment)
/* Returns: (nullable): the character data of @string (i.e. NULL if @free_segment is TRUE)  */
gchar* g_string_free(GString *string, gboolean free_segment)
{
  gchar *segment;
  g_return_val_if_fail (string != NULL, NULL);
  if (free_segment)
    {
      g_free (string->str);
      segment = NULL;
    }
  else
    segment = string->str;
  g_slice_free (GString, string);
  return segment;
}