hdf_dlist.h
Overview
Related Modules:
Description:
Declares doubly linked list structures and interfaces.
This file provides interfaces such as inserting a node from the head or tail of a doubly linked list, checking whether a doubly linked list is empty, traversing a doubly linked list, and merging doubly linked lists.
Since:
1.0
Version:
1.0
Summary
Data Structures
| Data Structure Name | Description |
|---|---|
| DListHead | Describes a doubly linked list. |
Macros
| Macro Name and Value | Description |
|---|---|
| CONTAINER_OF(ptr, type, member) (type )((char )(ptr) - (char )&((type )0)->member) | Obtains the address of a structure variable from its member address. |
| DLIST_FIRST_ENTRY(ptr, type, member) CONTAINER_OF((ptr)->next, type, member) | Obtains the first node of a doubly linked list. |
| DLIST_LAST_ENTRY(ptr, type, member) CONTAINER_OF((ptr)->prev, type, member) | Obtains the last node of a doubly linked list. |
| DLIST_FOR_EACH_ENTRY(pos, head, type, member) | Traverses all nodes in a doubly linked list. |
| DLIST_FOR_EACH_ENTRY_SAFE(pos, tmp, head, type, member) | Traverses all nodes in a doubly linked list. This function is used to delete the nodes pointed to by pos during traversal. |
Functions
| Function Name | Description |
|---|---|
| DListHeadInit (struct DListHead head) | static void Initializes a doubly linked list. |
| DListIsEmpty (const struct DListHead head) | static bool Checks whether a doubly linked list is empty. |
| DListRemove (struct DListHead entry) | static void Removes a node from a doubly linked list. |
| DListInsertHead (struct DListHead entry, struct DListHead head) | static void Inserts a node from the head of a doubly linked list. |
| DListInsertTail (struct DListHead entry, struct DListHead head) | static void Inserts a node from the tail of a doubly linked list. |
| DListMerge (struct DListHead list, struct DListHead *head) | static void Merges two linked lists by adding the list specified by list to the head of the list specified by head and initializes the merged list. |
