[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] Fix for strstr.S (revision 2)

From: Theodore A. Roth
Subject: Re: [avr-libc-dev] Fix for strstr.S (revision 2)
Date: Tue, 10 Dec 2002 12:12:42 -0800 (PST)

Hi Philip,

Thanks for fixing strstr().

Attached is what I'll probably commit to cvs.

I took out the code to check for a single char string then call strchr().
It turns out that gcc does that for you automagically when you turn on
optimizations, but it doesn't if you don't. I ran your test case
successfully with -O2 and without.

I did notice that your test case is missing a check to make sure that the
returned value is the expected pointer. I've also attached a program which
also tests this.

Ted Roth

On Tue, 10 Dec 2002, Philip Søeberg wrote:

:) A bug was found in the previous strstr.S :(
:) Mikael (address@hidden):
:) >>Try to use the string "abcdecdefg" and then search for "def". It will
:) >>fail. Probably because it finds the first "de" but not the "f". And for
:) >>some reason it doesn't find the second "de" (with the "f") afterwards.
:) This has now been fixed among other issues, such that this version work
:) quite fine :)
:) It fully supports the ANSI C3.159-1989 standard:
:)      If s2 is found within s1, pointer to first occurrence in s1 is
:) returned.
:)      If s2 is NOT found withing s1, NULL is returned.
:)      If s2 is empty, s1 is returned.
:) It has been tested with mega103/128 and at90s8515/8535 using AStudio3.55.
:) Regards.
:) -=[ Philip Soeberg ]=[ address@hidden ]=-

Attachment: strstr.diff
Description: Text document

Attachment: test2.c
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]