Loading...
Searching...
No Matches
List
SPA » Utilities

Doubly linked list data structure. More...

## Files

file | list.h
| `spa/utils/list.h`

## Data Structures

struct | spa_list

## Macros

#define | SPA_LIST_INIT(list) ((struct spa_list){ (list), (list) })
#define | spa_list_is_empty(l) ((l)->next == (l))
#define | spa_list_first(head, type, member) SPA_CONTAINER_OF((head)->next, type, member)
#define | spa_list_last(head, type, member) SPA_CONTAINER_OF((head)->prev, type, member)
#define | spa_list_append(list, item) spa_list_insert((list)->prev, item)
#define | spa_list_prepend(list, item) spa_list_insert(list, item)
#define | spa_list_is_end(pos, head, member) (&(pos)->member == (head))
#define | spa_list_next(pos, member) SPA_CONTAINER_OF((pos)->member.next, __typeof__(*(pos)), member)
#define | spa_list_prev(pos, member) SPA_CONTAINER_OF((pos)->member.prev, __typeof__(*(pos)), member)
#define | spa_list_consume(pos, head, member)
#define | spa_list_for_each_next(pos, head, curr, member)
#define | spa_list_for_each_prev(pos, head, curr, member)
#define | spa_list_for_each(pos, head, member) spa_list_for_each_next(pos, head, head, member)
#define | spa_list_for_each_reverse(pos, head, member) spa_list_for_each_prev(pos, head, head, member)
#define | spa_list_for_each_safe_next(pos, tmp, head, curr, member)
#define | spa_list_for_each_safe_prev(pos, tmp, head, curr, member)
#define | spa_list_for_each_safe(pos, tmp, head, member) spa_list_for_each_safe_next(pos, tmp, head, head, member)
#define | spa_list_for_each_safe_reverse(pos, tmp, head, member) spa_list_for_each_safe_prev(pos, tmp, head, head, member)
#define | spa_list_cursor_start(cursor, head, member) spa_list_prepend(head, &(cursor).member)
#define | spa_list_for_each_cursor(pos, cursor, head, member)
#define | spa_list_cursor_end(cursor, member) spa_list_remove(&(cursor).member)

## Functions

static void | spa_list_init (struct spa_list *list)
static int | spa_list_is_initialized (struct spa_list *list)
static void | spa_list_insert (struct spa_list *list, struct spa_list *elem)
static void | spa_list_insert_list (struct spa_list *list, struct spa_list *other)
static void | spa_list_remove (struct spa_list *elem)

## Detailed Description

Doubly linked list data structure.

## Macro Definition Documentation

## SPA_LIST_INIT

#define SPA_LIST_INIT | ( |  | list | ) | ((struct spa_list){ (list), (list) })

## spa_list_is_empty

#define spa_list_is_empty | ( |  | l | ) | ((l)->next == (l))

Examples
  export-source.c.

## spa_list_first

#define spa_list_first | ( |  | head,
|  |  | type,
|  |  | member
| ) |  | SPA_CONTAINER_OF((head)->next, type, member)

Examples
  export-source.c.

## spa_list_last

#define spa_list_last | ( |  | head,
|  |  | type,
|  |  | member
| ) |  | SPA_CONTAINER_OF((head)->prev, type, member)

## spa_list_append

#define spa_list_append | ( |  | list,
|  |  | item
| ) |  | spa_list_insert((list)->prev, item)

Examples
  bluez-session.c, and export-source.c.

## spa_list_prepend

#define spa_list_prepend | ( |  | list,
|  |  | item
| ) |  | spa_list_insert(list, item)

## spa_list_is_end

#define spa_list_is_end | ( |  | pos,
|  |  | head,
|  |  | member
| ) |  | (&(pos)->member == (head))

## spa_list_next

#define spa_list_next | ( |  | pos,
|  |  | member
| ) |  | SPA_CONTAINER_OF((pos)->member.next, __typeof__(*(pos)), member)

## spa_list_prev

#define spa_list_prev | ( |  | pos,
|  |  | member
| ) |  | SPA_CONTAINER_OF((pos)->member.prev, __typeof__(*(pos)), member)

## spa_list_consume

#define spa_list_consume | ( |  | pos,
|  |  | head,
|  |  | member
| ) |  |

## spa_list_for_each_next

#define spa_list_for_each_next | ( |  | pos,
|  |  | head,
|  |  | curr,
|  |  | member
| ) |  |

## spa_list_for_each_prev

#define spa_list_for_each_prev | ( |  | pos,
|  |  | head,
|  |  | curr,
|  |  | member
| ) |  |

## spa_list_for_each

#define spa_list_for_each | ( |  | pos,
|  |  | head,
|  |  | member
| ) |  | spa_list_for_each_next(pos, head, head, member)

Examples
  bluez-session.c.

## spa_list_for_each_reverse

#define spa_list_for_each_reverse | ( |  | pos,
|  |  | head,
|  |  | member
| ) |  | spa_list_for_each_prev(pos, head, head, member)

## spa_list_for_each_safe_next

#define spa_list_for_each_safe_next | ( |  | pos,
|  |  | tmp,
|  |  | head,
|  |  | curr,
|  |  | member
| ) |  |

## spa_list_for_each_safe_prev

#define spa_list_for_each_safe_prev | ( |  | pos,
|  |  | tmp,
|  |  | head,
|  |  | curr,
|  |  | member
| ) |  |

## spa_list_for_each_safe

#define spa_list_for_each_safe | ( |  | pos,
|  |  | tmp,
|  |  | head,
|  |  | member
| ) |  | spa_list_for_each_safe_next(pos, tmp, head, head, member)

## spa_list_for_each_safe_reverse

#define spa_list_for_each_safe_reverse | ( |  | pos,
|  |  | tmp,
|  |  | head,
|  |  | member
| ) |  | spa_list_for_each_safe_prev(pos, tmp, head, head, member)

## spa_list_cursor_start

#define spa_list_cursor_start | ( |  | cursor,
|  |  | head,
|  |  | member
| ) |  | spa_list_prepend(head, &(cursor).member)

## spa_list_for_each_cursor

#define spa_list_for_each_cursor | ( |  | pos,
|  |  | cursor,
|  |  | head,
|  |  | member
| ) |  |

## spa_list_cursor_end

#define spa_list_cursor_end | ( |  | cursor,
|  |  | member
| ) |  | spa_list_remove(&(cursor).member)

## Function Documentation

## spa_list_init()

static void spa_list_init | ( | struct spa_list * | list | ) |

inline static

Examples
  bluez-session.c, and export-source.c.

## spa_list_is_initialized()

static int spa_list_is_initialized | ( | struct spa_list * | list | ) |

inline static

## spa_list_insert()

static void spa_list_insert | ( | struct spa_list * | list,
|  | struct spa_list * | elem
| ) |  |

inline static

## spa_list_insert_list()

static void spa_list_insert_list | ( | struct spa_list * | list,
|  | struct spa_list * | other
| ) |  |

inline static

## spa_list_remove()

static void spa_list_remove | ( | struct spa_list * | elem | ) |

inline static

Examples
  bluez-session.c, and export-source.c.