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: Wed, 15 Apr 2015 13:33:22 +0100
- 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>
ping
> Wilco Dijkstra wrote:
> > > 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);
>
> OK for trunk with __strnlen?
>
> Wilco