GNU bug report logs -
#50507
New function in Emacs GnuTLS implementation
Previous Next
Full log
Message #93 received at 50507 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Fri, 30 Sep 2022 09:49:30 -0400, Nikolaos Chatzikonstantinou <nchatz314 <at> gmail.com> said:
Nikolaos> +static unsigned int
Nikolaos> +key_file2_aux (Lisp_Object flags)
Nikolaos> +{
Nikolaos> + unsigned int rv = 0;
Nikolaos> + Lisp_Object tail = flags;
Nikolaos> + FOR_EACH_TAIL_SAFE (tail)
Nikolaos> + {
Nikolaos> + Lisp_Object flag = XCAR (tail);
Nikolaos> + if (EQ (flag, Qgnutls_pkcs_plain))
Nikolaos> + rv |= GNUTLS_PKCS_PLAIN;
Nikolaos> + else if(EQ (flag, Qgnutls_pkcs_pkcs12_3des))
Space after 'if' here and in the rest of the function
Nikolaos> +# ifdef HAVE_GNUTLS_CERTIFICATE_SET_X509_KEY_FILE2
Nikolaos> + if (STRINGP (pass))
Nikolaos> + ret = gnutls_certificate_set_x509_key_file2
Nikolaos> + (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format,
Nikolaos> + SSDATA (pass), key_file2_aux (flags));
Nikolaos> + else if (NILP (pass) && plist_member (proplist, QCpass))
Nikolaos> + ret = gnutls_certificate_set_x509_key_file2
Nikolaos> + (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format,
Nikolaos> + NULL, key_file2_aux (flags));
Nikolaos> + else
Nikolaos> + ret = gnutls_certificate_set_x509_key_file
Nikolaos> + (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format);
Nikolaos> +# else
Nikolaos> ret = gnutls_certificate_set_x509_key_file
Nikolaos> (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format);
Nikolaos> +# endif
2 minor points:
- If you use an intermediate variable for
the C version of pass, you can set it correctly based on `plist_member'
etc, and only have one call to _file2 (as it is itʼs kind of
difficult to quickly see the difference between the two calls)
- I think you can then rework the #else/#endif here to avoid repetition of
the call to the _file variant
Robert
--
This bug report was last modified 2 years and 197 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.