avoid calling strlen() twice in readlink()
Eric Blake
eblake@redhat.com
Thu Mar 8 15:29:00 GMT 2012
On 03/08/2012 06:37 AM, Václav Zeman wrote:
> Hi.
>
> Here is a tiny patch to avoid calling strlen() twice in readlink().
>
>
> - ssize_t len = min (buflen, strlen (pathbuf.get_win32 ()));
> + size_t pathbuf_len = strlen (pathbuf.get_win32 ());
> + size_t len = MIN (buflen, pathbuf_len);
> memcpy (buf, pathbuf.get_win32 (), len);
For that matter, is calling pathbuf.get_win32() twice worth factoring out?
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20120308/8f9ae11f/attachment.sig>
More information about the Cygwin-patches
mailing list