* A small bug in strrchr
@ 2012-05-26 21:05 Richard Pennington
2012-05-26 22:06 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Richard Pennington @ 2012-05-26 21:05 UTC (permalink / raw)
To: musl
Hi,
I found a small bug in strrchr().
strrchr("string", '\0') does not return a pointer to the trailing nul byte.
Here is the corrected version:
#include <string.h>
void *__memrchr(const void *, int, size_t);
char *strrchr(const char *s, int c)
{
return __memrchr(s, c, strlen(s) + 1);
}
(I added the + 1)
-Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: A small bug in strrchr
2012-05-26 21:05 A small bug in strrchr Richard Pennington
@ 2012-05-26 22:06 ` Rich Felker
2012-05-26 22:12 ` Richard Pennington
0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2012-05-26 22:06 UTC (permalink / raw)
To: musl
On Sat, May 26, 2012 at 04:05:28PM -0500, Richard Pennington wrote:
> Hi,
>
> I found a small bug in strrchr().
> [...]
Thanks! Much appreciated; I just fixed this and the other two issues
in git.
In the future, could you please send proposed fixes/improvements as
unified diff ("diff -u" or simply "git diff") instead of just pasting
the new file? It makes it a lot easier to tell what's being changed.
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: A small bug in strrchr
2012-05-26 22:06 ` Rich Felker
@ 2012-05-26 22:12 ` Richard Pennington
2012-05-26 22:40 ` Szabolcs Nagy
0 siblings, 1 reply; 5+ messages in thread
From: Richard Pennington @ 2012-05-26 22:12 UTC (permalink / raw)
To: musl
On Saturday, May 26, 2012 06:06:13 PM Rich Felker wrote:
[snip]
> In the future, could you please send proposed fixes/improvements as
> unified diff ("diff -u" or simply "git diff") instead of just pasting
> the new file? It makes it a lot easier to tell what's being changed.
I will diff from now on. I was working pretty quickly today and was a little
lazy.
-Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: A small bug in strrchr
2012-05-26 22:12 ` Richard Pennington
@ 2012-05-26 22:40 ` Szabolcs Nagy
2012-05-26 22:50 ` Richard Pennington
0 siblings, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2012-05-26 22:40 UTC (permalink / raw)
To: musl
i wonder how you found the bugs
are you using posixtest or you have your own set of tests?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: A small bug in strrchr
2012-05-26 22:40 ` Szabolcs Nagy
@ 2012-05-26 22:50 ` Richard Pennington
0 siblings, 0 replies; 5+ messages in thread
From: Richard Pennington @ 2012-05-26 22:50 UTC (permalink / raw)
To: musl; +Cc: musl
On May 26, 2012, at 5:40 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> i wonder how you found the bugs
>
> are you using posixtest or you have your own set of tests?
I caught these with my own set of tests. They're pretty simple right now, but I'm adding to them as I go along.
-Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-05-26 22:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-26 21:05 A small bug in strrchr Richard Pennington
2012-05-26 22:06 ` Rich Felker
2012-05-26 22:12 ` Richard Pennington
2012-05-26 22:40 ` Szabolcs Nagy
2012-05-26 22:50 ` Richard Pennington
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).