[PATCH] Improve strncpy performance further

Roland McGrath roland@hack.frob.com
Wed Apr 15 18:27:00 GMT 2015


> > > 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?

Style and whatnot is fine now.  I have no opinion one way or the other
about this being an appropriate performance change.



More information about the Libc-alpha mailing list