refactor(argparse): 将null替换为nullptr以提高C++兼容性

- 在argparse库中将所有null指针常量替换为nullptr
- 更新头文件和源文件中的指针初始化和比较操作
- 修改测试文件中的相关断言检查
- 更新AST定义文件中的注释说明
This commit is contained in:
zzy
2026-04-05 20:18:09 +08:00
parent 27d86d5685
commit 4144f7841c
76 changed files with 1430 additions and 998 deletions

View File

@@ -25,7 +25,7 @@ static inline sccf_sym_t *
sccf_builder_get_symbol_unsafe(sccf_builder_t *builder, const char *name) {
usize idx = sccf_builder_get_symbol_idx(builder, name);
if (idx == 0) {
return null;
return nullptr;
}
return &scc_vec_at(builder->symtab, idx);
}

View File

@@ -34,12 +34,12 @@ static inline u8 *sccf_sect_header_table(u8 *base) {
* @brief 获取指定索引的节头指针
* @param base 文件缓冲区起始地址
* @param idx 节索引 (0 <= idx < sect_header_num)
* @return 指向该节头的指针, 若索引无效返回 null
* @return 指向该节头的指针, 若索引无效返回 nullptr
*/
static inline sccf_sect_header_t *sccf_sect_header(u8 *base, usize idx) {
sccf_header_t *hdr = (sccf_header_t *)base;
if (idx >= (usize)hdr->sect_header_num)
return null;
return nullptr;
u8 *table = sccf_sect_header_table(base);
return (sccf_sect_header_t *)(table + idx * sizeof(sccf_sect_header_t));
}
@@ -76,11 +76,11 @@ static inline usize sccf_sect_data_offset(u8 *base, usize idx) {
* @brief 获取指定索引的节数据起始地址
* @param base 文件缓冲区起始地址
* @param idx 节索引
* @return 数据起始地址, 若索引无效返回 null
* @return 数据起始地址, 若索引无效返回 nullptr
*/
static inline u8 *sccf_sect_data(u8 *base, usize idx) {
usize off = sccf_sect_data_offset(base, idx);
return (off == 0) ? null : base + off;
return (off == 0) ? nullptr : base + off;
}
/** @} */