修改了一些错误
This commit is contained in:
parent
b22c2f7976
commit
46c9b1f3b4
|
@ -6,15 +6,15 @@
|
||||||
#define LIST_POISON1 NULL
|
#define LIST_POISON1 NULL
|
||||||
#define LIST_POISON2 NULL
|
#define LIST_POISON2 NULL
|
||||||
|
|
||||||
//计算member在type中的位置
|
//计算member在type中的位置
|
||||||
#define offsetof(type, member) (size_t)(&((type*)0)->member)
|
#define offsetof(type, member) (size_t)(&((type*)0)->member)
|
||||||
|
|
||||||
//根据member的地址获取type的起始地址
|
//根据member的地址获取type的起始地址
|
||||||
#define container_of(ptr, type, member) ({ \
|
#define container_of(ptr, type, member) ({ \
|
||||||
const typeof(((type *)0)->member)*__mptr = (ptr); \
|
const typeof(((type *)0)->member)*__mptr = (ptr); \
|
||||||
(type *)((char *)__mptr - offsetof(type, member)); })
|
(type *)((char *)__mptr - offsetof(type, member)); })
|
||||||
|
|
||||||
//链表结构
|
//链表结构
|
||||||
struct list_head
|
struct list_head
|
||||||
{
|
{
|
||||||
struct list_head *prev;
|
struct list_head *prev;
|
||||||
|
@ -53,7 +53,7 @@ extern void __list_add(struct list_head *new,
|
||||||
struct list_head *next);
|
struct list_head *next);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//从头部添加
|
//从头部添加
|
||||||
/**
|
/**
|
||||||
* list_add - add a new entry
|
* list_add - add a new entry
|
||||||
* @new: new entry to be added
|
* @new: new entry to be added
|
||||||
|
@ -71,7 +71,7 @@ static inline void list_add(struct list_head *new, struct list_head *head)
|
||||||
extern void list_add(struct list_head *new, struct list_head *head);
|
extern void list_add(struct list_head *new, struct list_head *head);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//从尾部添加
|
//从尾部添加
|
||||||
static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
||||||
{
|
{
|
||||||
__list_add(new, head->prev, head);
|
__list_add(new, head->prev, head);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* @Author: your name
|
* @Author: your name
|
||||||
* @Date: 2021-09-20 19:59:05
|
* @Date: 2021-09-20 19:59:05
|
||||||
* @LastEditTime: 2021-09-20 20:07:50
|
* @LastEditTime: 2022-02-17 22:41:13
|
||||||
* @LastEditors: Please set LastEditors
|
* @LastEditors: Please set LastEditors
|
||||||
* @Description: In User Settings Edit
|
* @Description: In User Settings Edit
|
||||||
* @FilePath: /xcmd/inc/xcmd_define.h
|
* @FilePath: /xcmd/inc/xcmd_define.h
|
||||||
|
@ -94,7 +94,7 @@ extern "C" {
|
||||||
#define DCH(n) "\x1B[%dP",n /* 删除字符 删除当前光标位置的 <n> 个字符,这会从屏幕右边缘以空格字符移动。*/
|
#define DCH(n) "\x1B[%dP",n /* 删除字符 删除当前光标位置的 <n> 个字符,这会从屏幕右边缘以空格字符移动。*/
|
||||||
#define ECH(n) "\x1B[%dX",n /* 擦除字符 擦除当前光标位置的 <n> 个字符,方法是使用空格字符覆盖它们。*/
|
#define ECH(n) "\x1B[%dX",n /* 擦除字符 擦除当前光标位置的 <n> 个字符,方法是使用空格字符覆盖它们。*/
|
||||||
#define IL(n) "\x1B[%dL",n /* 插入行 将 <n> 行插入光标位置的缓冲区。 光标所在的行及其下方的行将向下移动。*/
|
#define IL(n) "\x1B[%dL",n /* 插入行 将 <n> 行插入光标位置的缓冲区。 光标所在的行及其下方的行将向下移动。*/
|
||||||
#define DL(n) "\x1B[%dM\r",n /* 删除行 从缓冲区中删除 <n> 行,从光标所在的行开始。*/
|
#define DL(n) "\x1B[%dM",n /* 删除行 从缓冲区中删除 <n> 行,从光标所在的行开始。*/
|
||||||
|
|
||||||
/* 打印字体颜色设置 */
|
/* 打印字体颜色设置 */
|
||||||
#define TX_DEF "\x1b[0m"
|
#define TX_DEF "\x1b[0m"
|
||||||
|
|
|
@ -296,7 +296,7 @@ static void xcmd_parser(uint8_t byte)
|
||||||
|
|
||||||
if(num > 0)
|
if(num > 0)
|
||||||
{
|
{
|
||||||
if( !(g_xcmder.parser.recv_hook_func && g_xcmder.parser.recv_hook_func(g_xcmder.parser.encode_buf)) )
|
if( !(g_xcmder.parser.recv_hook_func && !g_xcmder.parser.recv_hook_func(g_xcmder.parser.encode_buf)) )
|
||||||
{
|
{
|
||||||
if(CMD_IS_PRINT(g_xcmder.parser.encode_buf[0]))
|
if(CMD_IS_PRINT(g_xcmder.parser.encode_buf[0]))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue