Hi,

"AndrXs" Giraldo <[EMAIL PROTECTED]> writes:

> typedef _data
>   {
>     char *string;
>     int value;
>   } data;
> 
> data comboitem;
> 
> GList *liste = NULL;
> 
> >   comboitem = g_malloc(sizeof(struct _data));
> >   strcpy(comboitem.string, "toto");
> >   liste = g_list_insert(liste, comboitem, 0);
> > 
> >   comboitem = g_malloc(sizeof(struct _data));
> >   strcpy(comboitem.string, "tata");
> >   liste = g_list_insert(liste, comboitem, 0);

this code should probably read:

  typedef struct _data
  {
    char *string;
    int value;
  } data;
 
  data *comboitem;

  GList *liste = NULL;

  comboitem = g_new (data, 1);
  comboitem->string = g_strdup ("toto");
  liste = g_list_prepend (liste, comboitem);
 
  comboitem = g_new (data, 1);
  comboitem->string = g_strdup ("tata");
  liste = g_list_prepend (liste, comboitem);


don't forget to free your strings again (using g_free).


Salut, Sven


_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to