Class (GI Struct)

GLib-2.0GLibList

The GLib.List struct is used for each element in a doubly-linked list.

Index

Constructors

Properties

data: any
next: any[]
prev: any[]
$gtype: GType<GLib.List>

Methods

  • Copies a GLib.List.

    Note that this is a "shallow" copy. If the list elements consist of pointers to data, the pointers are copied but the actual data is not. See g_list_copy_deep() if you need to copy the data as well.

    Parameters

    • list: any[]

      a GLib.List, this must point to the top of the list

    Returns any[]

  • Frees all of the memory used by a GLib.List. The freed elements are returned to the slice allocator.

    If list elements contain dynamically-allocated memory, you should either use g_list_free_full() or free them manually first.

    It can be combined with g_steal_pointer() to ensure the list head pointer is not left dangling:

    GList *list_of_borrowed_things = …;  /<!-- -->* (transfer container) *<!-- -->/
    g_list_free (g_steal_pointer (&list_of_borrowed_things));

    Parameters

    Returns void