From owner-freebsd-hackers Sat May 12 7:13:22 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 35D4737B43E for ; Sat, 12 May 2001 07:13:19 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 56845 invoked by uid 1000); 12 May 2001 14:12:41 -0000 Date: Sat, 12 May 2001 17:12:41 +0300 From: Peter Pentchev To: Valentin Nechayev Cc: Daniel Hemmerich , freebsd-hackers@FreeBSD.ORG Subject: Re: adding a new function to libc Message-ID: <20010512171240.A54542@ringworld.oblivion.bg> Mail-Followup-To: Valentin Nechayev , Daniel Hemmerich , freebsd-hackers@FreeBSD.ORG References: <01051202104500.95296@blackhole.BSDpro.com> <20010512170544.A343@iv.nn.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010512170544.A343@iv.nn.kiev.ua>; from netch@iv.nn.kiev.ua on Sat, May 12, 2001 at 05:05:44PM +0300 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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