Re: [hackers] [libsl] die() on failure in ecalloc?

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat, 5 Nov 2016 11:48:57 +0100

On Fri, Nov 04, 2016 at 07:53:35PM +0100, Markus Teich wrote:
> Heyho Hiltjo,
>
> > > My proposal would be to change ecalloc to use die() and in the rare cases
> > > where the allocation error should be handled gracefully just don't use
> > > ecalloc, but calloc directly.
> > >
> > > Btw: The drw unification patches are still not merged to libsl, only to dwm,
> > > dmenu and sent.
> > >
> >
> > Do you want to (re)send the patch or should I just change it?
>
> Just patch util.c in dmenu and dwm to use die(), as I just did it in sent. If
> you also maintain libsl, feel free to use the old patch queue with explanations
> in the commit messages or just create a new commit by pulling drw.[ch] and
> util.[ch] from one of the other projects.
>

Thanks, pushed to dmenu and dwm and copied drw.c, drw.h, arg.h and util.c to libsl.
I noticed the arg.h fix was also not merged, but it is now ;)

> > > I can at least imagine cases where quitting on allocation failure is not
> > > good. For example dwm is running, a new client starting up, but there is no
> > > memory left for the client struct. In this case dwm should just print an
> > > error, but not quit to give the user the chance to fix the problem without
> > > losing all their work in the other clients (which would die as well, if dwm
> > > dies and the X-Server quits).
> > >
> >
> > I agree it should either die completely or give a very clear error message.
>
> I'll make a patch for dwm.
>

No need anymore :)

-- 
Kind regards,
Hiltjo
Received on Sat Nov 05 2016 - 11:48:57 CET

This archive was generated by hypermail 2.3.0 : Sat Nov 05 2016 - 12:00:23 CET