[gnutls-devel] GnuTLS | sockets: fixed building for Windows with compilers without VLA support (alternative version) (!1490)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Fri Nov 26 17:03:16 CET 2021




Evgeny Grin commented on a discussion on lib/system/sockets.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1490#note_745152351

>  system_writev(gnutls_transport_ptr_t ptr, const giovec_t * iovec,
>  	      int iovec_cnt)
>  {
> -	WSABUF bufs[iovec_cnt];
> +	WSABUF bufs[32];
>  	DWORD bytes_sent;
>  	int to_send_cnt = 0;
>  	size_t to_send_bytes = 0;
>  
> -	while (to_send_cnt < iovec_cnt && to_send_bytes < SSIZE_MAX) {
> +	while (to_send_cnt < iovec_cnt &&
> +			(size_t) to_send_cnt < sizeof(bufs) / sizeof(bufs[0]) &&

Good point, readability is bad.

I think that I've even better way to improve readability (and code performance).

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1490#note_745152351
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20211126/7785ba30/attachment-0001.html>


More information about the Gnutls-devel mailing list