mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
binpac: Generate range-based for loops for array cleanup
This commit is contained in:
parent
65da8cf5de
commit
5264b957f1
1 changed files with 2 additions and 3 deletions
|
@ -383,11 +383,10 @@ void ArrayType::GenCleanUpCode(Output* out_cc, Env* env)
|
||||||
out_cc->inc_indent();
|
out_cc->inc_indent();
|
||||||
out_cc->println("{");
|
out_cc->println("{");
|
||||||
|
|
||||||
out_cc->println("for ( int i = 0; i < (int) %s->size(); ++i )", env->RValue(value_var()));
|
out_cc->println("for ( auto* %s : *%s )", env->LValue(elem_var()),
|
||||||
|
env->RValue(value_var()));
|
||||||
out_cc->inc_indent();
|
out_cc->inc_indent();
|
||||||
out_cc->println("{");
|
out_cc->println("{");
|
||||||
out_cc->println("%s %s = (*%s)[i];", elemtype_->DataTypeStr().c_str(),
|
|
||||||
env->LValue(elem_var()), lvalue());
|
|
||||||
elemtype_->GenCleanUpCode(out_cc, env);
|
elemtype_->GenCleanUpCode(out_cc, env);
|
||||||
out_cc->println("}");
|
out_cc->println("}");
|
||||||
out_cc->dec_indent();
|
out_cc->dec_indent();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue