Re: [Fwd: Need Help using GLib -> GList]



Jerry DeLisle wrote:
[...]
Can anyone give me some hints?

Dont allocate the GList's yourself, just pass NULL as the
list head for `hand' (no need to have a dataless list element).

And while looping through items always use a list
pointer besides your list head, i.e.:

GList *list, *l;

if ((list = create_list ()) != NULL) {
    l = list;
    while (l && l->data) {
       /* Use iterator */
       l = l->next;
    }
    /* free list head */
    g_list_free (list);
}

Cheers,
                              -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]