[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.4.2 (src/lundump.c) LoadProtos, remove loop initialization
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 10 Nov 2020 15:46:00 -0300
> I think that it is possible to safely remove the initialization loop from the loadProtos function.
> Because the same array will be overwritten in the next loop, in the same positions.
> Is this correct?
No, it is not. The call to luaF_newproto in the next loop may raise
errors and f->p needs to be in a consistent state. The comments in the
loops in loadUpvalues also apply to loadProtos.
I don't mean to be harsh and we do welcome suggestions and
corrections, but do you really think we write useless code?