Opened 12 years ago

Closed 12 years ago

#8265 closed enhancement (fixed)

memrchr implementation

Reported by: Barrett Owned by: nobody
Priority: normal Milestone: R1
Component: Kits Version: R1/Development
Keywords: memrchr, libc, glibc Cc:
Blocked By: Blocking:
Platform: All

Description

The memrchr was missing when i tried to compile wget, it's a glibc function...

http://www.delorie.com/gnu/docs/glibc/libc_77.html

so i've written a implementation. I've tested it using the attached test program and all seems ok.

Attachments (3)

test.c (305 bytes ) - added by Barrett 12 years ago.
memrchr.diff (1.5 KB ) - added by Barrett 12 years ago.
memrchr3.diff (2.0 KB ) - added by Barrett 12 years ago.

Download all attachments as: .zip

Change History (10)

by Barrett, 12 years ago

Attachment: test.c added

by Barrett, 12 years ago

Attachment: memrchr.diff added

comment:1 by Barrett, 12 years ago

patch: 01

comment:2 by korli, 12 years ago

The function is already present in libroot, but not in string.h. It looks like the current implementation is optimized.

comment:3 by X512, 12 years ago

I search «memrchr» in public headers, but I can't find it. I found «memrchr» in libroot code so only modifications in posix/string.h are needed.

comment:4 by korli, 12 years ago

Yeah it should be added with a _GNU_SOURCE guard because memrchr is a GNU extension and only expected by GNU.

by Barrett, 12 years ago

Attachment: memrchr3.diff added

comment:5 by Barrett, 12 years ago

As you can see, other than adding memrchr i've tried to group other gnu extensions like strcasestr and strnlen into the _GNU_SOURCE guard, but this is breaking the build. What should i do then? Leave it as is or go over the broken code and define _GNU_SOURCE where needed?

comment:7 by korli, 12 years ago

Resolution: fixed
Status: newclosed

Applied in hrev43619 with USE_GNU instead. Thanks!

Note: See TracTickets for help on using tickets.