Mikhail Karpov, le ven. 26 juin 2026 16:19:45 +0700, a ecrit:
> I've corrected the parts you pointed out.

Applied, thanks!


> There's just one thing that
> bothers me:
> On Tue, 23 Jun 2026 02:20:15 Samuel Thibault wrote:
> > Since we can't return an error code, better use assert_backtrace to
> > crash.
> >
> > > +        }
> > > +    }
> > >    else
> > > -    buf = alloca (qr->amount);
> > > +    {
> > > +      buf = alloca (qr->amount);
> > > +      if (!buf)
> > > +     {
> > > +       pthread_spin_unlock (&readlock);
> > > +       return;
> >
> > Same here.
> It turns out that alloca doesn't return NULL if it fails, so this check is
> pointless. But how safe is this function to use?

I depends what you call "safe".

It indeed doesn't allow to catch stack overflows (it would be too
expensive to make it do it).

When the amount to be allocated is bounded, it's fine to use it, we can
assume there will be enough room (just like we already assume it has
enough room for function calls, variables, etc.). If it is not bounded,
better use a malloc.

Samuel

Reply via email to