Re: [dwm] dmenu patches: case insensivity, common keys, emacs keys

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sat, 22 Sep 2007 21:26:15 +0200

On Sat, Sep 22, 2007 at 06:36:17PM +0200, Nico Golde wrote:
> Hi,
> * Micha?? Janeczek <janeczek_AT_gmail.com> [2007-09-22 18:02]:
> [...]
> > +int (*comparefunc)(const char*, const char*, size_t) = strncmp;
> [...]
> > for(i = allitems; i; i=i->next)
> > - if(plen && strncmp(pattern, i->text, plen)
> > + if(plen && comparefunc(pattern, i->text, plen)
> [...]
> > + else if(!strcmp(argv[i], "-c")) {
> > + comparefunc = strncasecmp;
> > + }
> > else if(!strcmp(argv[i], "-fn")) {
> > if(++i < argc) font = argv[i];
>
> What is the reason to use a function pointer here to use
> different compare functions under the same name besides that
> it becomes more difficult to track what the code actually
> does?

Sorry, I disagree. The opposite of using flag-based comparisions
seems more nasty. But actually first I need good reasons to
accept that case-insensitive pattern matching is necessary at
all (and if so, what's with ido-matching?

Regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Sat Sep 22 2007 - 21:26:15 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:54:30 UTC