Date: Sat, 12 May 2001 17:12:41 +0300 From: Peter Pentchev <roam@orbitel.bg> To: Valentin Nechayev <netch@iv.nn.kiev.ua> Cc: Daniel Hemmerich <dan@BSDpro.com>, freebsd-hackers@FreeBSD.ORG Subject: Re: adding a new function to libc Message-ID: <20010512171240.A54542@ringworld.oblivion.bg> In-Reply-To: <20010512170544.A343@iv.nn.kiev.ua>; from netch@iv.nn.kiev.ua on Sat, May 12, 2001 at 05:05:44PM %2B0300 References: <01051202104500.95296@blackhole.BSDpro.com> <20010512170544.A343@iv.nn.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, May 12, 2001 at 05:05:44PM +0300, Valentin Nechayev wrote:
> Hello Daniel Hemmerich!
[snip]
>
> Here strnlen() is used which is non-standard but I saw it in ~4 quite
> different projects (e.g. Linux kernel) with identical interface
> and result value; a variant of implementation follows:
>
> /* This is candidate to have optimized assembler variant */
> size_t strnlen( const char* src, size_t max )
> {
> size_t n;
> while( n < max && *src != '\0' )
> n++;
> return n;
> }
I really hope you meant *src++ there :)
G'luck,
Peter
--
If there were no counterfactuals, this sentence would not have been paradoxical.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010512171240.A54542>
