Re: Problem with GtkCList, dynamically creating with N columns...
- From: Sven Neumann <sven gimp org>
- To: "Wrinkled Shirt" <wrinkledshirt hotmail com>
- Cc: gtk-list gnome org
- Subject: Re: Problem with GtkCList, dynamically creating with N columns...
- Date: 06 Mar 2001 12:49:18 +0100
Hi,
"J. Ali Harlow" <gtk-list avrc city ac uk> writes:
> That should be blankrow = (char **) malloc(vpsql->cols * sizeof(*blankrow));
Or glib-ish:
blankrow = g_new ((gchar *), vpsql->cols);
But remember to use g_free() to free the memory g_new() allocates
for you.
> > for (ctr=0; ctr<vpsql->cols; ctr++)
> > {
> > (char *)blankrow[ctr] = (char *)malloc(2);
> > sprintf((char *)blankrow[ctr]," ");
>
> These two lines could be blankrow[ctr] = strdup("")
or:
for (ctr = 0; ctr < vpsql->cols; ctr++)
blankrow[ctr] = "";
since it shouldn't hurt to use the same constant empty string
everywhere. In that case you should of course not try to free
it later.
Salut, Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]