Skip to content

ListPushFront

Description

Default head-push aliases the L-form: link a new node holding lval’s payload as the new head, taking ownership of lval when no deep-copy handler is configured.

Parameters

Name Direction Description
l in,out List handle.
lval in Addressable element to prepend.

Success

Returns true; the list length grows by one.

Failure

Returns false on allocation failure; the list and lval are unchanged.

Usage example (Cross-references)

Usage examples (Cross-references)
        ListPushFrontR(&list, h);
        ListPushBackR(&list, e);
        ListPushFront(&list, f);
        ListPushBackL(&list, i);
        ListPushBack(&list, g);
    #define ListMustPushFront(l, lval)                                                                                     \
        do {                                                                                                               \
            if (!ListPushFront((l), (lval))) {                                                                             \
                LOG_FATAL("ListMustPushFront failed");                                                                     \
            }                                                                                                              \
Last updated on