On 6/26/08, Marc Andre Tanner <[EMAIL PROTECTED]> 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.