refactor(argparse): 将null替换为nullptr以提高C++兼容性
- 在argparse库中将所有null指针常量替换为nullptr - 更新头文件和源文件中的指针初始化和比较操作 - 修改测试文件中的相关断言检查 - 更新AST定义文件中的注释说明
This commit is contained in:
@@ -14,11 +14,11 @@ void sccf_builder_init(sccf_builder_t *builder) {
|
||||
scc_vec_init(builder->relocs);
|
||||
scc_vec_init(builder->symtab);
|
||||
|
||||
builder->entry_symbol_name = null;
|
||||
builder->entry_symbol_name = nullptr;
|
||||
|
||||
///< Push null
|
||||
///< Push nullptr
|
||||
scc_vec_push(builder->strtab, (char)'\0');
|
||||
///< Push null
|
||||
///< Push nullptr
|
||||
scc_vec_push(builder->symtab, (sccf_sym_t){0});
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ void sccf_builder_add_section(sccf_builder_t *builder,
|
||||
}
|
||||
|
||||
const sccf_t *sccf_builder_to_sccf(sccf_builder_t *builder) {
|
||||
if (builder->entry_symbol_name == null) {
|
||||
if (builder->entry_symbol_name == nullptr) {
|
||||
builder->sccf.header.entry_point = 0;
|
||||
} else {
|
||||
sccf_sym_t *sym =
|
||||
sccf_builder_get_symbol_unsafe(builder, builder->entry_symbol_name);
|
||||
if (sym == null || sym->sccf_sect_type != SCCF_SECT_CODE) {
|
||||
if (sym == nullptr || sym->sccf_sect_type != SCCF_SECT_CODE) {
|
||||
LOG_ERROR("entry symbol %s not found");
|
||||
builder->sccf.header.entry_point = 0;
|
||||
} else {
|
||||
@@ -125,14 +125,14 @@ const sccf_t *sccf_builder_to_sccf(sccf_builder_t *builder) {
|
||||
}
|
||||
|
||||
void sccf_builder_to_buffer(sccf_builder_t *builder, sccf_buffer_t *buffer) {
|
||||
Assert(builder != null && buffer != null);
|
||||
Assert(builder != nullptr && buffer != nullptr);
|
||||
sccf_write(sccf_builder_to_sccf(builder), buffer);
|
||||
}
|
||||
|
||||
void sccf_builder_to_file(sccf_builder_t *builder, const char *file_path) {
|
||||
Assert(builder != null && file_path != null);
|
||||
Assert(builder != nullptr && file_path != nullptr);
|
||||
scc_file_t fp = scc_fopen(file_path, SCC_FILE_WRITE);
|
||||
if (fp == null) {
|
||||
if (fp == nullptr) {
|
||||
LOG_ERROR("file can't open %s", file_path);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user