On 22 November 2010 15:26, Connor Lane Smith <c...@lubutu.com> wrote: > On 22 November 2010 12:01, Anselm R Garbe <garb...@gmail.com> wrote: >> I prefer to keep cleanup() even if it slows down the performance >> (which I doubt will be noticeable) just for the sake of keeping the >> symmetry that the code that allocates resources also deallocates them. >> This might sound a bit pedantic and useless in case of dmenu, but I >> prefer to be consistent here. > > I think that pedantic and useless code for the sake of consistency is > more at home in GNU software than in Suckless. If code is provably a > waste of time and space it should have no place in dmenu. If memory > was allocated during use I would agree with you, as a leak would be > possible. But it isn't.
Well no cleanup sounds rather like GNU to me tbh. Anyways, if it was just about the items that are malloc'ed I would probably agree. But it is also about cleaning up acquired X resources properly. Not doing this somehow violates the style of X clients. If an X window is created, I would destroy it on exit. Similarly I would free pixmaps and ungrab the keyboard. It's just about good style, not about saving every possible line of code. Complex cleanup is also an indicator for a broken data structure. So if the cleanup can't be done easily, then we should start from scratch. But this isn't the case in dmenu. Cheers, Anselm