Re: g_locale_to_utf8
- From: "Hubert Sokolowski" <h sokolowski wsisiz edu pl>
- To: "Viraj Chatterjee" <vchatter adobe com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_locale_to_utf8
- Date: Mon, 10 Jan 2005 10:29:37 +0100 (CET)
Second version but with modifications...
g_free(string); // free memory returned in g_strdup
g_free(s); // free memory returned in g_locale_to_utf8
you are wrong, this is wrong since you are loosing the pointer to a newly
allocated buffer allocated by g_locate_to_utf8, that you should free.
-vc
----- Original Message -----
From: "Andreas Volz" <lists brachttal net>
To: <gtk-app-devel-list gnome org>
Sent: Monday, January 10, 2005 2:46 PM
Subject: g_locale_to_utf8
Hi,
I've a question how to use the return of the g_locale_to_utf8 function.
For example I've this code:
----------------------
gchar *s;
gchar *string;
string = g_strdup ("hallo");
s = g_locale_to_utf8 (string,-1,0,0,0);
g_print ("%s\n", s);
free (string);
-----------------------
Or should I do:
...
s = g_strdup (g_locale_to_utf8 (string,-1,0,0,0));
g_print ("%s\n", s);
free (string);
free (s);
As I think it's the second version, but I'm not sure. Can you help me?
regards
Andreas
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]