Class (GI Struct)

GLib-2.0GLibSList

The GLib.SList struct is used for each element in the singly-linked list.

Index

Constructors

Properties

data: any
next: any[]
$gtype: GType<SList>

Methods

  • Copies a GLib.SList.

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

    Parameters

    Returns any[]

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

    If list elements contain dynamically-allocated memory, you should either use g_slist_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:

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

    Parameters

    Returns void