bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: crypto/gc-md2: optimize and clarify code
Date: Sat, 24 Aug 2019 16:14:58 +0200	[thread overview]
Message-ID: <3371168.FpREjUSgGq@omega> (raw)

Make lib/gc-gnulib.c and lib/gc-libgcrypt.c more consistent with each other.


2019-08-24  Bruno Haible  <bruno@clisp.org>

	crypto/gc-md2: Optimize and clarify code.
	* lib/gc-gnulib.c (gc_hash_open): Comment out md2_init_ctx invocation.
	* lib/gc-libgcrypt.c (gc_hash_open): Clarify why md2_init_ctx invocation
	is not needed.

diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c
index 62aa50a..6fcb4a1 100644
--- a/lib/gc-gnulib.c
+++ b/lib/gc-gnulib.c
@@ -646,7 +646,8 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle)
     {
 #if GNULIB_GC_MD2
     case GC_MD2:
-      md2_init_ctx (&ctx->md2Context);
+      /* Not needed, because ctx is already zero-initialized.  */
+      /*md2_init_ctx (&ctx->md2Context);*/
       break;
 #endif
 
diff --git a/lib/gc-libgcrypt.c b/lib/gc-libgcrypt.c
index 6c95712..fbfd0a1 100644
--- a/lib/gc-libgcrypt.c
+++ b/lib/gc-libgcrypt.c
@@ -270,9 +270,13 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle)
 
   switch (hash)
     {
+#if GNULIB_GC_MD2
     case GC_MD2:
+      /* Not needed, because ctx is already zero-initialized.  */
+      /*md2_init_ctx (&ctx->md2Context);*/
       gcryalg = GCRY_MD_NONE;
       break;
+#endif
 
     case GC_MD4:
       gcryalg = GCRY_MD_MD4;



                 reply	other threads:[~2019-08-24 14:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3371168.FpREjUSgGq@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).