This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH] Improve strncpy performance further
- From: "Wilco Dijkstra" <wdijkstr at arm dot com>
- To: "'Roland McGrath'" <roland at hack dot frob dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Fri, 9 Jan 2015 13:07:42 -0000
- Subject: RE: [PATCH] Improve strncpy performance further
- Authentication-results: sourceware.org; auth=none
- References: <001801d02b72$6ce0c3c0$46a24b40$ at com> <20150108185812 dot 285782C3BF6 at topped-with-meat dot com>
> Roland McGrath:
> Has to be __strnlen.
Good point, so it becomes:
- return s;
+ size_t size = __strnlen (s2, n);
+ if (size != n)
+ memset (s1 + size, '\0', n - size);
+ return memcpy (s1, s2, size);
Btw while on the subject on namespaces, is bcopy correctly defined?
After a lot of complex inclusion and defines, it ultimately does:
void
bcopy ()
{
...
}
Wilco