1 Star 0 Fork 1

swunzg/rtos

forked from erickhuang/rtos 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
raw_list.h 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
erickhuang 提交于 2017-07-15 19:24 . first commit
/**************************************************************************************************
Filename: raw_list.h
Author: HYT
Created: 2015-11-20
Revised:
Description:
Notes:
Copyright 2015 Autel. All rights reserved.
**************************************************************************************************/
#ifndef _RAW_LIST_H_
#define _RAW_LIST_H_
#include <stdint.h>
/*
* Doubly-link list
*/
typedef struct _LIST {
struct _LIST *next;
struct _LIST *previous;
} LIST;
#define list_entry(node, type, member) ((type *)((uint8_t *)(node) - (uint32_t)(&((type *)0)->member)))
/*
* List initialization
*/
#define list_init(list_head) \
do {\
(list_head)->next = (list_head);\
(list_head)->previous = (list_head);\
} while (0)
/*
* return TRUE if the list is empty
*/
#define is_list_empty(list) ((list)->next == (list))
/*
* add element to list
* add element before head.
*/
#define list_insert(head, element) \
do {\
(element)->previous = (head)->previous;\
(element)->next = (head);\
(head)->previous->next = (element);\
(head)->previous = (element);\
} while (0)
/*
* delete element from list
*/
#define list_delete(element) \
do {\
(element)->previous->next = (element)->next;\
(element)->next->previous = (element)->previous;\
} while (0)
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/swunzg/rtos.git
git@gitee.com:swunzg/rtos.git
swunzg
rtos
rtos
master

搜索帮助