Changeset b94bc6c in mainline


Ignore:
Timestamp:
2012-11-22T21:05:59Z (11 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
85eba4c
Parents:
c0c26ac
Message:

Added LIST_INITIALIZER (to uspace) which initializes statically allocated list_t variables but does not declare them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/list.h

    rc0c26ac rb94bc6c  
    5757 */
    5858#define LIST_INITIALIZE(name) \
    59         list_t name = { \
     59        list_t name = LIST_INITIALIZER(name)
     60
     61/** Initializer for statically allocated list.
     62 *
     63 * @code
     64 * struct named_list {
     65 *     const char *name;
     66 *     list_t list;
     67 * } var = {
     68 *     .name = "default name",
     69 *     .list = LIST_INITIALIZER(name_list.list)
     70 * };
     71 * @endcode
     72 *
     73 * @param name Name of the new statically allocated list.
     74 *
     75 */
     76#define LIST_INITIALIZER(name) \
     77        { \
    6078                .head = { \
    6179                        .prev = &(name).head, \
Note: See TracChangeset for help on using the changeset viewer.