Opened 7 years ago

Closed 7 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:
Has a Patch: yes 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 7 years ago.
memrchr.diff (1.5 KB) - added by Barrett 7 years ago.
memrchr3.diff (2.0 KB) - added by Barrett 7 years ago.

Download all attachments as: .zip

Change History (10)

Changed 7 years ago by Barrett

Attachment: test.c added

Changed 7 years ago by Barrett

Attachment: memrchr.diff added

comment:1 Changed 7 years ago by Barrett

Has a Patch: set

comment:2 Changed 7 years ago by korli

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

comment:3 Changed 7 years ago by X512

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 Changed 7 years ago by korli

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

Changed 7 years ago by Barrett

Attachment: memrchr3.diff added

comment:5 Changed 7 years ago by Barrett

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 Changed 7 years ago by korli

Resolution: fixed
Status: newclosed

Applied in hrev43619 with USE_GNU instead. Thanks!

Note: See TracTickets for help on using tickets.