Changeset ff90f5f in mainline


Ignore:
Timestamp:
2012-07-10T17:32:33Z (12 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3954961e
Parents:
0d56712
Message:

adt: Added a func to move a list to the beginning/end of another.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/adt/list.h

    r0d56712 rff90f5f  
    306306 * Both lists may be empty.
    307307 *
    308  * In order to insert the list at the beginning of another list, use:
    309  * @code
    310  * list_splice(&list_dest.head, &list_src);
    311  * @endcode
    312  *
    313308 * @param list Source list to move after pos.
    314309 * @param pos Source items will be placed after this item.
     
    330325                list_initialize(list);
    331326        }
     327}
     328
     329/** Moves all items of list @a src to the end of list @a dest.
     330 *
     331 * Both lists may be empty.
     332 *
     333 * @param src Source list to move. Becomes empty.
     334 * @param dest Items of src will be inserted at the end of this list, ie
     335 *             after all items of src.
     336 */
     337NO_TRACE static inline void list_append_list(list_t *src, list_t *dest)
     338{
     339        list_splice(src, dest->head.prev);
     340}
     341
     342/** Moves all items of list @a src to the beginning of list @a dest.
     343 *
     344 * Both lists may be empty.
     345 *
     346 * @param src Source list to move. Becomes empty.
     347 * @param dest Items of src will be inserted at the beginning of this list.
     348 */
     349NO_TRACE static inline void list_prepend_list(list_t *src, list_t *dest)
     350{
     351        list_splice(src, &dest->head);
    332352}
    333353
Note: See TracChangeset for help on using the changeset viewer.