refactor(argparse): 将null替换为nullptr以提高C++兼容性
- 在argparse库中将所有null指针常量替换为nullptr - 更新头文件和源文件中的指针初始化和比较操作 - 修改测试文件中的相关断言检查 - 更新AST定义文件中的注释说明
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
#ifndef __KLLIST_H__
|
||||
#define __KLLIST_H__
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (0)
|
||||
#define __NULL_KLIST_DEFINED__
|
||||
#ifndef nullptr
|
||||
#define nullptr (0)
|
||||
#define __nullptr_KLIST_DEFINED__
|
||||
#endif
|
||||
|
||||
#ifndef container_of
|
||||
@@ -88,8 +88,8 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) {
|
||||
|
||||
static inline void list_del(struct list_head *entry) {
|
||||
__list_del(entry->prev, entry->next);
|
||||
entry->next = NULL;
|
||||
entry->prev = NULL;
|
||||
entry->next = nullptr;
|
||||
entry->prev = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,8 +159,9 @@ typedef int (*list_cmp_func_t)(void *, const struct list_head *,
|
||||
static void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp);
|
||||
#endif
|
||||
|
||||
#if defined(__NULL_KLIST_DEFINED__) && !defined(__NULL_KLIST_DEFINED_NOMOVE__)
|
||||
#undef NULL
|
||||
#if defined(__nullptr_KLIST_DEFINED__) && \
|
||||
!defined(__nullptr_KLIST_DEFINED_NOMOVE__)
|
||||
#undef nullptr
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user