Browse code

Fixed some compile issues with show_library_versions()

* Refactored show_library_versions to work around the fact
that some compilers (such as MSVC 2008) can't handle #ifdefs
inside of macro references.

* Declare show_library_versions() in options.h because it's
referenced by other files such as openvpn.c.

* Declare get_ssl_library_version() as returning const char *,
to avoid loss of const qualifier in ssl_openssl.c.

Signed-off-by: James Yonan <james@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1399589436-8730-7-git-send-email-james@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8711
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit a91a2d6ad7b139ec78d61c8616b8447847e9ecc6)

James Yonan authored on 2014/05/09 07:50:36
Showing 5 changed files
... ...
@@ -3439,18 +3439,21 @@ usage_small (void)
3439 3439
 void
3440 3440
 show_library_versions(const unsigned int flags)
3441 3441
 {
3442
-  msg (flags, "library versions: %s%s%s",
3443 3442
 #ifdef ENABLE_SSL
3444
-			get_ssl_library_version(),
3443
+#define SSL_LIB_VER_STR get_ssl_library_version()
3445 3444
 #else
3446
-			"",
3445
+#define SSL_LIB_VER_STR ""
3447 3446
 #endif
3448 3447
 #ifdef ENABLE_LZO
3449
-			", LZO ", lzo_version_string()
3448
+#define LZO_LIB_VER_STR ", LZO ", lzo_version_string()
3450 3449
 #else
3451
-			"", ""
3450
+#define LZO_LIB_VER_STR "", ""
3452 3451
 #endif
3453
-	);
3452
+
3453
+  msg (flags, "library versions: %s%s%s", SSL_LIB_VER_STR, LZO_LIB_VER_STR);
3454
+
3455
+#undef SSL_LIB_VER_STR
3456
+#undef LZO_LIB_VER_STR
3454 3457
 }
3455 3458
 
3456 3459
 static void
... ...
@@ -691,6 +691,8 @@ void notnull (const char *arg, const char *description);
691 691
 
692 692
 void usage_small (void);
693 693
 
694
+void show_library_versions(const unsigned int flags);
695
+
694 696
 void init_options (struct options *o, const bool init_gc);
695 697
 void uninit_options (struct options *o);
696 698
 
... ...
@@ -485,6 +485,6 @@ void get_highest_preference_tls_cipher (char *buf, int size);
485 485
  * return a pointer to a static memory area containing the
486 486
  * name and version number of the SSL library in use
487 487
  */
488
-char * get_ssl_library_version(void);
488
+const char * get_ssl_library_version(void);
489 489
 
490 490
 #endif /* SSL_BACKEND_H_ */
... ...
@@ -1439,7 +1439,7 @@ get_highest_preference_tls_cipher (char *buf, int size)
1439 1439
   SSL_CTX_free (ctx);
1440 1440
 }
1441 1441
 
1442
-char *
1442
+const char *
1443 1443
 get_ssl_library_version(void)
1444 1444
 {
1445 1445
     return SSLeay_version(SSLEAY_VERSION);
... ...
@@ -1121,7 +1121,7 @@ get_highest_preference_tls_cipher (char *buf, int size)
1121 1121
   strncpynt (buf, cipher_name, size);
1122 1122
 }
1123 1123
 
1124
-char *
1124
+const char *
1125 1125
 get_ssl_library_version(void)
1126 1126
 {
1127 1127
     static char polar_version[30];