Re: [dwm] dmenu - simplification of cistrstr and kpress

From: Sander van Dijk <>
Date: Thu, 26 Jun 2008 17:24:30 +0200

On 6/26/08, Marc Andre Tanner <> wrote:
> Premysl Hruby wrote:
>>>> patch attached.
>>> "return (char *)1;"?
>>> cistrstr(s, sub) is supposed to return a pointer to the first
>>> occurence of "sub" in "s", or NULL if there is none; not some fixed
>>> pointer to memory that's probably not even allocated to the process.
>>> Greetings, Sander.
>> Yes, that's true, but return value is only used only in comparison if is
>> or isn't null, to signalize that substring is or isn't contained in the
>> string.
> Then change the return type to bool or int or whatever and avoid the
> ugly casts.

That would be better, but then it still wouldn't do the right thing:

    if (strcasecmp(s, sub) == 0)

is only true when "s" is exactly the same (ignoring case, of course)
as "sub", which would make

    cistrstr("blaat", "aa")

NOT match, which is wrong.

Gr. Sander.
Received on Thu Jun 26 2008 - 17:24:31 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:51:35 UTC