[openssl/openssl] f5eac2: list: add a doubly linked list type.

Pauli noreply at github.com
Mon Sep 5 06:27:31 UTC 2022

  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: f5eac259a03c68c96c77f9b998b1b9c16a8439e7
  Author: Pauli <pauli at openssl.org>
  Date:   2022-09-05 (Mon, 05 Sep 2022)

  Changed paths:
    A doc/internal/man3/DEFINE_LIST_OF.pod
    A include/internal/list.h
    M test/build.info
    A test/list_test.c
    A test/recipes/02-test_list.t

  Log Message:
  list: add a doubly linked list type.

These list can be embedded into structures and structures can be members of
multiple lists.  Moreover, this is done without dynamic memory allocation.
That is, this is legal:

    typedef struct item_st ITEM;

    struct item_st {
        OSSL_LIST_MEMBER(new_items, ITEM);
        OSSL_LIST_MEMBER(failed_items, ITEM);

    DEFINE_LIST_OF(new_items, TESTL);
    DEFINE_LIST_OF(failed_items, TESTL);

    struct {
        OSSL_LIST(new_items) new;
        OSSL_LIST(failed_items) failed;
    } *st;

    ITEM *p;

    for (p = ossl_list_new_items_head(&st->new); p != NULL;
         p = ossl_list_new_items_next(p))
        /* do something */

Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19115)

More information about the openssl-commits mailing list