[gnutls-devel] GnuTLS | Certificate type handling improvements (!1394)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Fri Feb 26 17:56:07 CET 2021




Daiki Ueno commented on a discussion on lib/ext/server_cert_type.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1394#note_518230758

>  						gnutls_buffer_st* data)
>  {
>  	int ret;
> -	uint8_t cert_type; // Holds an IANA cert type ID
> +	uint8_t cert_type_IANA; // Holds an IANA cert type ID
> +	uint8_t cert_types[GNUTLS_CRT_MAX]; // The list with supported (IANA) cert types. Inv: 0 <= cert type Id < 256
>  	uint8_t i = 0, num_cert_types = 0;
>  	priority_st* cert_priorities;
>  	gnutls_datum_t tmp_cert_types; // For type conversion

I meant for readability; otherwise one would need to go to the beginning of the function every time when she wants to know the type of a variable used in the middle of the function. 

Although the current code doesn't exceed the [5-10 limit](https://www.kernel.org/doc/html/latest/process/coding-style.html#functions), it's approaching to it (9 currently). I wouldn't say we should split the function, but re-organizing with separate code blocks would make the code a little more readable.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1394#note_518230758
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/20210226/7d891b14/attachment.html>


More information about the Gnutls-devel mailing list