[Serdev] ENUM enhancements
Greger V. Teigre
greger at teigre.com
Thu Jun 23 06:52:58 UTC 2005
:-) Thanks for correcting me. I guess I need to re-read the developer's
manual...
g-)
Andrei Pelinescu-Onciul wrote:
> On Jun 21, 2005 at 17:20, Greger V. Teigre <greger at teigre.com> wrote:
>> Function: void * memmem (const void *haystack, size_t haystack-len,
>> const void *needle, size_t needle-len)
>> This is like strstr, but needle and haystack are byte arrays rather
>> than null-terminated strings. needle-len is the length of needle and
>> haystack-len is the length of haystack.
>>
>> This function is a GNU extension.
>
> Unfortunately, being a GNU extension means only linux has it (and
> probably hurd). For example it's missing on openbsd.
> The only solution is to write it.
>
>
> BTW the function that needs to be replaced is strrchr, which searches
> only for a char, but in reverse order (from the end to the beginning).
> q_memchr in ut.h can be used as a model =>
>
> static inline q_memrchr(char* s, int c, unsigned int size)
> {
> char* p;
>
> for(p=s+size-1;p>=s;p--)
> if (*p==(unsigned char)c) return p;
> return 0;
> }
>
>
> Andrei
More information about the Serdev
mailing list