yb_arm/osp/src/ospList.c
2023-07-12 14:14:31 +08:00

58 lines
993 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "osp.h"
static void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
static void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
static void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
next->prev = prev;
prev->next = next;
}
static inline void __list_del_entry(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
}
static inline void list_del(struct list_head *entry)
{
__list_del_entry(entry);
entry->next = NULL;
entry->prev = NULL;
}
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)