From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Joe Perches <joe@perches.com>,
Grant Likely <grant.likely@linaro.org>,
Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lib: string.c: A speed optimized for strncpy
Date: Wed, 15 Oct 2014 14:27:04 +0300 [thread overview]
Message-ID: <20141015112704.GM26918@mwanda> (raw)
In-Reply-To: <CAFo99gZp9WuxjJCwDmNStrm3uQRJq9VKRDZ3yT5R9rDrwft=oA@mail.gmail.com>
On Sun, Oct 05, 2014 at 06:01:43PM +0200, Rickard Strandqvist wrote:
> Hi
>
> Yes, it can be faster, even if it is as you say, probably a difference
> depending on the size of the count.
> And even greater need to test this on a variety of hardware :-/
Most architectures (the notable exception is ARM) have an their own
optimized strncpy() function. Probably strzcpy() should just call it.
char *strzcpy(char *dest, const char *src, size_t count)
{
strncpy(dest, src, count);
if (count)
dest[count - 1] = '\0';
return dest;
}
regards,
dan carpenter
prev parent reply other threads:[~2014-10-15 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-05 13:29 [PATCH] lib: string.c: A speed optimized for strncpy Rickard Strandqvist
2014-10-05 13:29 ` Rickard Strandqvist
2014-10-05 15:36 ` Joe Perches
2014-10-05 16:01 ` Rickard Strandqvist
2014-10-15 11:27 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141015112704.GM26918@mwanda \
--to=dan.carpenter@oracle.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=grant.likely@linaro.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rickard_strandqvist@spectrumdigital.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox