mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
binpac: Use nullptr in generated code
This commit is contained in:
parent
9f3750d0cc
commit
613ffef4a2
4 changed files with 13 additions and 10 deletions
|
@ -356,7 +356,7 @@ void ArrayType::GenInitCode(Output* out_cc, Env* env)
|
||||||
{
|
{
|
||||||
// Do not initiate the array here
|
// Do not initiate the array here
|
||||||
// out_cc->println("%s = new %s;", lvalue(), vector_str_.c_str());
|
// out_cc->println("%s = new %s;", lvalue(), vector_str_.c_str());
|
||||||
out_cc->println("%s = 0;", lvalue());
|
out_cc->println("%s = nullptr;", lvalue());
|
||||||
|
|
||||||
Type::GenInitCode(out_cc, env);
|
Type::GenInitCode(out_cc, env);
|
||||||
if ( incremental_parsing() )
|
if ( incremental_parsing() )
|
||||||
|
@ -563,7 +563,7 @@ void ArrayType::DoGenParseCode(Output* out_cc, Env* env, const DataPtr& data, in
|
||||||
GenUntilCheck(out_cc, env, attr_until_element_expr_, false);
|
GenUntilCheck(out_cc, env, attr_until_element_expr_, false);
|
||||||
|
|
||||||
if ( elemtype_->IsPointerType() )
|
if ( elemtype_->IsPointerType() )
|
||||||
out_cc->println("%s = 0;", env->LValue(elem_var()));
|
out_cc->println("%s = nullptr;", env->LValue(elem_var()));
|
||||||
|
|
||||||
out_cc->println("}");
|
out_cc->println("}");
|
||||||
out_cc->dec_indent();
|
out_cc->dec_indent();
|
||||||
|
@ -621,7 +621,7 @@ void ArrayType::GenUntilCheck(Output* out_cc, Env* env, Expr* until_expr, bool d
|
||||||
if ( delete_elem )
|
if ( delete_elem )
|
||||||
elemtype_->GenCleanUpCode(out_cc, env);
|
elemtype_->GenCleanUpCode(out_cc, env);
|
||||||
else
|
else
|
||||||
out_cc->println("%s = 0;", env->LValue(elem_var()));
|
out_cc->println("%s = nullptr;", env->LValue(elem_var()));
|
||||||
}
|
}
|
||||||
|
|
||||||
out_cc->println("goto %s;", end_of_array_loop_label_.c_str());
|
out_cc->println("goto %s;", end_of_array_loop_label_.c_str());
|
||||||
|
|
|
@ -42,8 +42,11 @@ string ExternType::EvalMember(const ID* member_id) const
|
||||||
|
|
||||||
void ExternType::GenInitCode(Output* out_cc, Env* env)
|
void ExternType::GenInitCode(Output* out_cc, Env* env)
|
||||||
{
|
{
|
||||||
if ( IsNumericType() || IsPointerType() )
|
if ( IsNumericType() )
|
||||||
out_cc->println("%s = 0;", env->LValue(value_var()));
|
out_cc->println("%s = 0;", env->LValue(value_var()));
|
||||||
|
else if ( IsPointerType() )
|
||||||
|
out_cc->println("%s = nullptr;", env->LValue(value_var()));
|
||||||
|
|
||||||
Type::GenInitCode(out_cc, env);
|
Type::GenInitCode(out_cc, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,8 @@ void FlowDecl::GenInitCode(Output* out_cc)
|
||||||
{
|
{
|
||||||
AnalyzerDecl::GenInitCode(out_cc);
|
AnalyzerDecl::GenInitCode(out_cc);
|
||||||
|
|
||||||
out_cc->println("%s = 0;", env_->LValue(dataunit_id));
|
out_cc->println("%s = nullptr;", env_->LValue(dataunit_id));
|
||||||
out_cc->println("%s = 0;", env_->LValue(analyzer_context_id));
|
out_cc->println("%s = nullptr;", env_->LValue(analyzer_context_id));
|
||||||
|
|
||||||
if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT )
|
if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT )
|
||||||
{
|
{
|
||||||
|
@ -147,7 +147,7 @@ void FlowDecl::GenEOFFunc(Output* out_h, Output* out_cc)
|
||||||
if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT )
|
if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT )
|
||||||
{
|
{
|
||||||
out_cc->println("%s->set_eof();", env_->LValue(flow_buffer_id));
|
out_cc->println("%s->set_eof();", env_->LValue(flow_buffer_id));
|
||||||
out_cc->println("%s(0, 0);", kNewData);
|
out_cc->println("%s(nullptr, nullptr);", kNewData);
|
||||||
}
|
}
|
||||||
|
|
||||||
out_cc->println("}");
|
out_cc->println("}");
|
||||||
|
|
|
@ -154,7 +154,7 @@ bool ParameterizedType::RequiresAnalyzerContext()
|
||||||
void ParameterizedType::GenInitCode(Output* out_cc, Env* env)
|
void ParameterizedType::GenInitCode(Output* out_cc, Env* env)
|
||||||
{
|
{
|
||||||
ASSERT(persistent());
|
ASSERT(persistent());
|
||||||
out_cc->println("%s = 0;", env->LValue(value_var()));
|
out_cc->println("%s = nullptr;", env->LValue(value_var()));
|
||||||
Type::GenInitCode(out_cc, env);
|
Type::GenInitCode(out_cc, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ void ParameterizedType::GenCleanUpCode(Output* out_cc, Env* env)
|
||||||
out_cc->println("Unref(%s);", lvalue());
|
out_cc->println("Unref(%s);", lvalue());
|
||||||
else
|
else
|
||||||
out_cc->println("delete %s;", lvalue());
|
out_cc->println("delete %s;", lvalue());
|
||||||
out_cc->println("%s = 0;", lvalue());
|
out_cc->println("%s = nullptr;", lvalue());
|
||||||
Type::GenCleanUpCode(out_cc, env);
|
Type::GenCleanUpCode(out_cc, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ void ParameterizedType::DoGenParseCode(Output* out_cc, Env* env, const DataPtr&
|
||||||
{
|
{
|
||||||
ASSERT(! ref_type->incremental_input());
|
ASSERT(! ref_type->incremental_input());
|
||||||
parse_func = kParseFuncWithoutBuffer;
|
parse_func = kParseFuncWithoutBuffer;
|
||||||
parse_params = "0, 0";
|
parse_params = "nullptr, nullptr";
|
||||||
}
|
}
|
||||||
else if ( ref_type->incremental_input() )
|
else if ( ref_type->incremental_input() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue