Re: [dev] [dmenu] bugs and senselessness

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Thu, 1 Apr 2010 21:38:17 +0100

On 1 April 2010 20:40, Connor Lane Smith <cls_AT_lubutu.com> wrote:
> The last dmenu revision doesn't make any sense. It goes through a load
> of hassle and complexity dynamically reallocating memory, and then has
> no real effect, because text is a fixed 4096 byte buffer. Items longer
> than 4096 chars are just plain inaccessible.
>
> There are two options here. Either at the end of readstdin we can
> "text = malloc(max)", and then pass around "max" instead of just using
> "sizeof text" (since pointers don't work in the same way as arrays)...
> which seems ugly to me... Or we can just use a 4096 byte buf in
> readstdin, which makes a lot of sense anyway.
>
> I've been working on a patch since before the recent commits anyway,
> so I've merged in the ^A and ^E keybindings, but just increased the
> size of the readstdin buf to sizeof text. If we *really* want dynamic
> allocation and to pass around a "max" value etc, I suppose I could
> merge that in instead, but I don't see the necessity: do we honestly
> need to add such complexity in order to support lines longer than
> 4096? Those are pretty epic line lengths for what is essentially a
> menu.
>
> So the following patch fixes some bugs and oddities separate to the
> whole dynamic alloc issue, as well as just increasing buf to sizeof
> text, basically doing the same job as the previous revision.

Forgot to mention I reviewed and applied your patch and added you to
the LICENSE file as well.

Cheers,
Anselm
Received on Thu Apr 01 2010 - 20:38:17 UTC

This archive was generated by hypermail 2.2.0 : Thu Apr 01 2010 - 20:48:04 UTC