Re: glib question: static GStrings?
- From: "Maher Awamy" <muhri muhri net>
- To: Peter Jay Salzman <p dirac org>, gtk-app-devel-list gnome org
- Subject: Re: glib question: static GStrings?
- Date: 16 Aug 2001 23:31:38 CDT
Hi Peter,
in your function
my_func(some params)
{
static GString my_String = NULL;
if (my_String == NULL) my_String = g_string_new();
/* your code here */
}
or if your string maybe null sometimes because you might have tinkered with it
my_func(some params)
{
static GString my_string = NULL;
static gint GString_Initilized = 0;
if (!GString_Initilized) { my_string = g_string_new();
GString_Initilized = 1;
}
}
hope this helps..
Maher
On Thu, 16 Aug 2001 13:15:46 -0700, Peter Jay Salzman said:
dear all,
i'd like to use a static GString to keep a string "around" for when the
function gets called again. the trouble is, the necessary call to
g_string_new() reinitializes the value of the GString.
one answer would be to make the GString global, but that's a wanky solution.
there has to be something better.
any ideas?
thanks!
pete
--
"The following addresses had permanent fatal errors..." p dirac org
-- Mailer Daemon www.dirac.org/p
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
http://www.muhri.net -- muhri muhri net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]