Changeset 1ebc1a62 in mainline for uspace/app/sbi/src/list.c


Ignore:
Timestamp:
2010-03-29T20:30:29Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a95310e
Parents:
5da468e
Message:

Update SBI to rev. 157.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/src/list.c

    r5da468e r1ebc1a62  
    4747static bool_t list_node_present(list_t *list, list_node_t *node);
    4848
    49 /** Initialize list. */
     49/** Initialize list.
     50 *
     51 * @param list  List to initialize.
     52 */
    5053void list_init(list_t *list)
    5154{
     
    5457}
    5558
    56 /** Append data to list. */
     59/** Append data to list.
     60 *
     61 * Create a new list node and append it at the end of the list.
     62 *
     63 * @param list  Linked list.
     64 * @param data  Data for the new node.
     65 */
    5766void list_append(list_t *list, void *data)
    5867{
     
    6372}
    6473
    65 /** Prepend data to list. */
     74/** Prepend data to list.
     75 *
     76 * Create a new list node and prepend it at the beginning of the list.
     77 *
     78 * @param list  Linked list.
     79 * @param data  Data for the new node.
     80 */
    6681void list_prepend(list_t *list, void *data)
    6782{
     
    7287}
    7388
    74 /** Remove data from list. */
     89/** Remove data from list.
     90 *
     91 * Removes the given node from a list and destroys it. Any data the node might
     92 * have is ignored. If asserts are on, we check wheter node is really present
     93 * in the list the caller is requesting us to remove it from.
     94 *
     95 * @param list  Linked list.
     96 * @param node  List node to remove.
     97 */
    7598void list_remove(list_t *list, list_node_t *node)
    7699{
     
    82105}
    83106
    84 /** Return first list node or NULL if list is empty. */
     107/** Return first list node or NULL if list is empty.
     108 *
     109 * @param list  Linked list.
     110 * @return      First node of the list or @c NULL if the list is empty.
     111 */
    85112list_node_t *list_first(list_t *list)
    86113{
     
    93120}
    94121
    95 /** Return last list node or NULL if list is empty. */
     122/** Return last list node or NULL if list is empty.
     123 *
     124 * @param list  Linked list.
     125 * @return      Last node of the list or @c NULL if the list is empty.
     126 */
    96127list_node_t *list_last(list_t *list)
    97128{
     
    104135}
    105136
    106 /** Return next list node or NULL if this was the last one. */
     137/** Return next list node or NULL if this was the last one.
     138 *
     139 * @param list  Linked list.
     140 * @param node  Node whose successor we are interested in.
     141 * @return      Following list node or @c NULL if @a node is last.
     142 */
    107143list_node_t *list_next(list_t *list, list_node_t *node)
    108144{
     
    114150}
    115151
    116 /** Return next list node or NULL if this was the last one. */
     152/** Return previous list node or NULL if this was the last one.
     153 *
     154 * @param list  Linked list.
     155 * @param node  Node whose predecessor we are interested in.
     156 * @return      Preceding list node or @c NULL if @a node is last.
     157 */
    117158list_node_t *list_prev(list_t *list, list_node_t *node)
    118159{
     
    124165}
    125166
    126 /** Return b_true if list is empty. */
     167/** Return b_true if list is empty.
     168 *
     169 * @param list  Linked list.
     170 * @return      @c b_true if list is empty, @c b_false otherwise.
     171 */
    127172bool_t list_is_empty(list_t *list)
    128173{
     
    130175}
    131176
    132 /** Change node data. */
     177/** Change node data.
     178 *
     179 * Change the data associated with a node.
     180 *
     181 * @param node  List node.
     182 * @param data  New data for node.
     183 */
    133184void list_node_setdata(list_node_t *node, void *data)
    134185{
     
    136187}
    137188
    138 /** Create new node. */
     189/** Create new node.
     190 *
     191 * @param data  Initial data for node.
     192 * @return      New list node.
     193 */
    139194static list_node_t *list_node_new(void *data)
    140195{
     
    154209}
    155210
    156 /** Delete node. */
     211/** Delete node.
     212 *
     213 * @param node  List node. Must not take part in any list.
     214 */
    157215static void list_node_delete(list_node_t *node)
    158216{
     
    163221}
    164222
    165 /** Insert node between two other nodes. */
    166 static void list_node_insert_between(list_node_t *n, list_node_t *a, list_node_t *b)
     223/** Insert node between two other nodes.
     224 *
     225 * Inserts @a n between neighboring nodes @a a and @a b.
     226 *
     227 * @param n     Node to insert.
     228 * @param a     Node to precede @a n.
     229 * @param b     Node to follow @a n.
     230 */
     231static void list_node_insert_between(list_node_t *n, list_node_t *a,
     232    list_node_t *b)
    167233{
    168234        assert(n->prev == NULL);
     
    177243}
    178244
    179 /** Unlink node. */
     245/** Unlink node.
     246 *
     247 * Unlink node from the list it is currently in.
     248 *
     249 * @param n     Node to unlink from its current list.
     250 */
    180251static void list_node_unlink(list_node_t *n)
    181252{
     
    197268}
    198269
    199 /** Check whether @a node is in list @a list. */
     270/** Check whether @a node is in list @a list.
     271 *
     272 * @param list  Linked list.
     273 * @param node  Node.
     274 * @return      @c b_true if @a node is part of @a list, @c b_false otherwise.
     275 */
    200276static bool_t list_node_present(list_t *list, list_node_t *node)
    201277{
Note: See TracChangeset for help on using the changeset viewer.