gcrypt: Simplify init_random_seed_or_die().
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 10 Jul 2016 14:43:02 +0000 (16:43 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 7 Jan 2017 19:23:40 +0000 (20:23 +0100)
Trivial equivalent transformation which gets rid of a local variable and
one level of indentation.

gcrypt.c

index 7d6b2ca..5202c9b 100644 (file)
--- a/gcrypt.c
+++ b/gcrypt.c
@@ -64,15 +64,13 @@ void get_random_bytes_or_die(unsigned char *buf, int num)
  */
 void init_random_seed_or_die(void)
 {
-       const char *ver, *req_ver;
-
-       ver = gcry_check_version(NULL);
-       req_ver = "1.5.0";
-       if (!gcry_check_version(req_ver)) {
-               PARA_EMERG_LOG("fatal: need at least libgcrypt-%s, have: %s\n",
-                       req_ver, ver);
-               exit(EXIT_FAILURE);
-       }
+       const char *req_ver = "1.5.0";
+
+       if (gcry_check_version(req_ver))
+               return;
+       PARA_EMERG_LOG("fatal: need at least libgcrypt-%s, have: %s\n",
+               req_ver, gcry_check_version(NULL));
+       exit(EXIT_FAILURE);
 }
 
 /** S-expression for the public part of an RSA key. */