]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
make function declarations C99 compliant
authorAntonio Quartulli <antonio@openvpn.net>
Fri, 11 Aug 2017 09:07:40 +0000 (17:07 +0800)
committerDavid Sommerseth <davids@openvpn.net>
Fri, 11 Aug 2017 19:59:30 +0000 (21:59 +0200)
In the attempt of adhering to the C99 standard as much as possible,
ensure that all the function declarations with no parameter contain
the "void" keyword[1].

Defects identified with sparse[2].

[1] ISO/IEC 9899:1999 spec, TC3 - section 6.7.5.3
[1] https://sparse.wiki.kernel.org/index.php/Main_Page

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <20170811090744.31750-2-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15203.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
27 files changed:
src/openvpn/buffer.c
src/openvpn/console.c
src/openvpn/console.h
src/openvpn/console_builtin.c
src/openvpn/console_systemd.c
src/openvpn/crypto.c
src/openvpn/crypto.h
src/openvpn/crypto_mbedtls.c
src/openvpn/crypto_mbedtls.h
src/openvpn/crypto_openssl.c
src/openvpn/error.c
src/openvpn/error.h
src/openvpn/init.c
src/openvpn/interval.h
src/openvpn/manage.c
src/openvpn/occ-inline.h
src/openvpn/packet_id.c
src/openvpn/packet_id.h
src/openvpn/pkcs11.c
src/openvpn/platform.c
src/openvpn/ps.c
src/openvpn/ssl.c
src/openvpn/ssl_backend.h
src/openvpn/ssl_mbedtls.c
src/openvpn/ssl_openssl.c
src/openvpn/win32.c
src/openvpn/win32.h

index 87e27ec0a9d356f5067cd262d8d4d1bb513c0564..a63ce14a42d1407d0410141b022cea27a2edbfbd 100644 (file)
@@ -180,7 +180,7 @@ buf_assign(struct buffer *dest, const struct buffer *src)
 }
 
 struct buffer
-clear_buf()
+clear_buf(void)
 {
     struct buffer buf;
     CLEAR(buf);
index eb6944d0ea66f8712ed489b2867c5c8f9f53b08f..7e1702416f6dac766a422d74f6b8c882bd5c9511 100644 (file)
@@ -44,7 +44,7 @@ struct _query_user query_user[QUERY_USER_NUMSLOTS];  /* GLOBAL */
 
 
 void
-query_user_clear()
+query_user_clear(void)
 {
     int i;
 
index aa51e6f687494537ac44c802b29f7c53b0df3a6b..3f74e77e7bb3252da52f8f99b169843eb964805e 100644 (file)
@@ -46,7 +46,7 @@ extern struct _query_user query_user[];  /**< Global variable, declared in conso
  * Wipes all data put into all of the query_user structs
  *
  */
-void query_user_clear();
+void query_user_clear(void);
 
 
 /**
@@ -72,7 +72,7 @@ void query_user_add(char *prompt, size_t prompt_len,
  *
  * @return True if executing all the defined steps completed successfully
  */
-bool query_user_exec_builtin();
+bool query_user_exec_builtin(void);
 
 
 #if defined(ENABLE_SYSTEMD)
@@ -83,7 +83,7 @@ bool query_user_exec_builtin();
  *
  * @return True if executing all the defined steps completed successfully
  */
-bool query_user_exec();
+bool query_user_exec(void);
 
 #else  /* ENABLE_SYSTEMD not defined*/
 /**
@@ -92,7 +92,7 @@ bool query_user_exec();
  *
  */
 static bool
-query_user_exec()
+query_user_exec(void)
 {
     return query_user_exec_builtin();
 }
index 7b95da9dd94127e41e7fde817963db5873d59090..f005ed748defcc499d66abbf7c9cf52eaef2a756 100644 (file)
@@ -267,7 +267,7 @@ get_console_input(const char *prompt, const bool echo, char *input, const int ca
  *
  */
 bool
-query_user_exec_builtin()
+query_user_exec_builtin(void)
 {
     bool ret = true; /* Presume everything goes okay */
     int i;
index 8cee8c8ed5455c8b7686eb23702748edcca9b15a..e7a72ae38405e3ecce88f2fce10d3bac7d7ab214 100644 (file)
@@ -41,7 +41,7 @@
  */
 
 static bool
-check_systemd_running()
+check_systemd_running(void)
 {
     struct stat c;
 
@@ -95,7 +95,7 @@ get_console_input_systemd(const char *prompt, const bool echo, char *input, cons
  *
  */
 bool
-query_user_exec()
+query_user_exec(void)
 {
     bool ret = true;  /* Presume everything goes okay */
     int i;
index 78ca4197b8d40dac43f595fb67769f474207431e..cc3c7b63875dbe84bb1c84d7ac28440111b0ffa3 100644 (file)
@@ -1693,7 +1693,7 @@ static int nonce_secret_len = 0; /* GLOBAL */
 
 /* Reset the nonce value, also done periodically to refresh entropy */
 static void
-prng_reset_nonce()
+prng_reset_nonce(void)
 {
     const int size = md_kt_size(nonce_md) + nonce_secret_len;
 #if 1 /* Must be 1 for real usage */
@@ -1772,7 +1772,7 @@ prng_bytes(uint8_t *output, int len)
 
 /* an analogue to the random() function, but use prng_bytes */
 long int
-get_random()
+get_random(void)
 {
     long int l;
     prng_bytes((unsigned char *)&l, sizeof(l));
index fec2eea7dc0f40df61c773292a4672ee5cfa9f3b..5dae383c55bb09be3d1747a6f5980e740a6c0a34 100644 (file)
@@ -453,7 +453,7 @@ void prng_init(const char *md_name, const int nonce_secret_len_parm);
  */
 void prng_bytes(uint8_t *output, int len);
 
-void prng_uninit();
+void prng_uninit(void);
 
 void test_crypto(struct crypto_options *co, struct frame *f);
 
index 30b51a5fbce4045dfb18e78c3190bf83b6e84435..f4d239bcfb900cdb209e674b47ab5676a481772e 100644 (file)
@@ -159,7 +159,7 @@ print_cipher(const cipher_kt_t *info)
 }
 
 void
-show_available_ciphers()
+show_available_ciphers(void)
 {
     const int *ciphers = mbedtls_cipher_list();
 
@@ -196,7 +196,7 @@ show_available_ciphers()
 }
 
 void
-show_available_digests()
+show_available_digests(void)
 {
     const int *digests = mbedtls_md_list();
 
@@ -223,7 +223,7 @@ show_available_digests()
 }
 
 void
-show_available_engines()
+show_available_engines(void)
 {
     printf("Sorry, mbed TLS hardware crypto engine functionality is not "
            "available\n");
@@ -243,7 +243,7 @@ show_available_engines()
  * entropy gathering function.
  */
 mbedtls_ctr_drbg_context *
-rand_ctx_get()
+rand_ctx_get(void)
 {
     static mbedtls_entropy_context ec = {0};
     static mbedtls_ctr_drbg_context cd_ctx = {0};
@@ -280,7 +280,7 @@ rand_ctx_get()
 
 #ifdef ENABLE_PREDICTION_RESISTANCE
 void
-rand_ctx_enable_prediction_resistance()
+rand_ctx_enable_prediction_resistance(void)
 {
     mbedtls_ctr_drbg_context *cd_ctx = rand_ctx_get();
 
index a434ce3489afe0e3863140587f5a758c765de3a6..4417b9240e1091c7499cf45bf4cef3878aa9a75c 100644 (file)
@@ -85,13 +85,13 @@ typedef mbedtls_md_context_t hmac_ctx_t;
  * added. During initialisation, a personalisation string will be added based
  * on the time, the PID, and a pointer to the random context.
  */
-mbedtls_ctr_drbg_context *rand_ctx_get();
+mbedtls_ctr_drbg_context *rand_ctx_get(void);
 
 #ifdef ENABLE_PREDICTION_RESISTANCE
 /**
  * Enable prediction resistance on the random number generator.
  */
-void rand_ctx_enable_prediction_resistance();
+void rand_ctx_enable_prediction_resistance(void);
 
 #endif
 
index 138455a41f3d4805ea9a2c971b21cd9de094204f..0134e55d579c26b02b6cb36ac836970429af7e49 100644 (file)
@@ -280,7 +280,7 @@ print_cipher(const EVP_CIPHER *cipher)
 }
 
 void
-show_available_ciphers()
+show_available_ciphers(void)
 {
     int nid;
     size_t i;
@@ -339,7 +339,7 @@ show_available_ciphers()
 }
 
 void
-show_available_digests()
+show_available_digests(void)
 {
     int nid;
 
@@ -364,7 +364,7 @@ show_available_digests()
 }
 
 void
-show_available_engines()
+show_available_engines(void)
 {
 #if HAVE_OPENSSL_ENGINE /* Only defined for OpenSSL */
     ENGINE *e;
index 3817666b6595beb59ccac5d4adc269164750e7e6..04bf0da5f8525f43584c92d8fe8ed15792b92b43 100644 (file)
@@ -159,7 +159,7 @@ set_machine_readable_output(bool parsable)
 }
 
 void
-error_reset()
+error_reset(void)
 {
     use_syslog = std_redir = false;
     suppress_timestamps = false;
@@ -480,7 +480,7 @@ open_syslog(const char *pgmname, bool stdio_to_null)
 }
 
 void
-close_syslog()
+close_syslog(void)
 {
 #if SYSLOG_CAPABILITY
     if (use_syslog)
@@ -635,7 +635,7 @@ unsigned int x_cs_verbose_level; /* GLOBAL */
 unsigned int x_cs_err_delay_ms;  /* GLOBAL */
 
 void
-reset_check_status()
+reset_check_status(void)
 {
     x_cs_info_level = 0;
     x_cs_verbose_level = 0;
index 14ef7e651b0182285bce401bb5b5622966c38e71..023cec463a24a781fbbd27dd9f9810200b07c142 100644 (file)
@@ -261,7 +261,7 @@ void msg_forked(void);
 
 void open_syslog(const char *pgmname, bool stdio_to_null);
 
-void close_syslog();
+void close_syslog(void);
 
 /* log file output */
 void redirect_stdout_stderr(const char *file, bool append);
index 860df7745281def2acc13b7c80eb217797048a63..f0fc2418a4678940d807bda0dbc744af9eb1757c 100644 (file)
@@ -1917,7 +1917,7 @@ do_close_tun(struct context *c, bool force)
 }
 
 void
-tun_abort()
+tun_abort(void)
 {
     struct context *c = static_context;
     if (c)
index 8095c0b97077ae74cf3e9c7a85ced32662755d9d..dd5dfbc8e5e709a5958a4905d013b1efdf6143eb 100644 (file)
@@ -155,7 +155,7 @@ event_timeout_clear(struct event_timeout *et)
 }
 
 static inline struct event_timeout
-event_timeout_clear_ret()
+event_timeout_clear_ret(void)
 {
     struct event_timeout ret;
     event_timeout_clear(&ret);
index ff94824044e343208b3d4d4301b100dd89eab3d6..3bbe972e5aa7775caf2b5bd4618112cb2b9269de 100644 (file)
@@ -68,7 +68,7 @@ static void man_output_standalone(struct management *man, volatile int *signal_r
 static void man_reset_client_socket(struct management *man, const bool exiting);
 
 static void
-man_help()
+man_help(void)
 {
     msg(M_CLIENT, "Management Interface for %s", title_string);
     msg(M_CLIENT, "Commands:");
index 68e9098f29b657c57c2cbfc30710016d984988a8..0fa8e5ba03b77bbc4b51a18c078951728643c5ec 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 static inline int
-occ_reset_op()
+occ_reset_op(void)
 {
     return -1;
 }
index 30ae8fbcbdd954a69a454c99f46e0867fee103c6..a3ff5722e1cade91b264162f73efb3985dfed5eb 100644 (file)
@@ -643,7 +643,7 @@ packet_id_debug_print(int msglevel,
 #ifdef PID_TEST
 
 void
-packet_id_interactive_test()
+packet_id_interactive_test(void)
 {
     struct packet_id pid;
     struct packet_id_net pin;
index a370936cd6c8c19b6bcad180f3f26fede9f45d6e..8509e5903b42f5f223501aafaa2c20f0fc08a9b5 100644 (file)
@@ -299,7 +299,7 @@ packet_id_persist_save_obj(struct packet_id_persist *p, const struct packet_id *
 const char *packet_id_net_print(const struct packet_id_net *pin, bool print_timestamp, struct gc_arena *gc);
 
 #ifdef PID_TEST
-void packet_id_interactive_test();
+void packet_id_interactive_test(void);
 
 #endif
 
index 604182807992f46e8c951fb67630a1962297610d..a0d0906aeaaf5400e1b2e4f4827388f4dc7c4cdb 100644 (file)
@@ -356,7 +356,7 @@ cleanup:
 }
 
 void
-pkcs11_terminate()
+pkcs11_terminate(void)
 {
     dmsg(
         D_PKCS11_DEBUG,
@@ -422,13 +422,13 @@ pkcs11_addProvider(
 }
 
 int
-pkcs11_logout()
+pkcs11_logout(void)
 {
     return pkcs11h_logout() == CKR_OK;
 }
 
 int
-pkcs11_management_id_count()
+pkcs11_management_id_count(void)
 {
     pkcs11h_certificate_id_list_t id_list = NULL;
     pkcs11h_certificate_id_list_t t = NULL;
index d936890e9e64344671cbe915eb61c5209db478f3..e942ba94a74356a538c07b249ae7a60d35046654 100644 (file)
@@ -173,7 +173,7 @@ platform_nice(int niceval)
 
 /* Get current PID */
 unsigned int
-platform_getpid()
+platform_getpid(void)
 {
 #ifdef _WIN32
     return (unsigned int) GetCurrentProcessId();
index c2b05cd951870f73e0caca106b8493961825fb41..45e24ded8fd00c84e5c8d2282046562481fc9094 100644 (file)
@@ -172,7 +172,7 @@ send_control(const socket_descriptor_t fd, int code)
 }
 
 static int
-cmsg_size()
+cmsg_size(void)
 {
     return CMSG_SPACE(sizeof(socket_descriptor_t));
 }
index df232894e853b602a88bda881529822c2d10566c..339baf7d66cf0b2dd53748a996003fbb3ffec89e 100644 (file)
@@ -347,7 +347,7 @@ tls_init_control_channel_frame_parameters(const struct frame *data_channel_frame
 }
 
 void
-init_ssl_lib()
+init_ssl_lib(void)
 {
     tls_init_lib();
 
@@ -355,7 +355,7 @@ init_ssl_lib()
 }
 
 void
-free_ssl_lib()
+free_ssl_lib(void)
 {
     crypto_uninit_lib();
     prng_uninit();
index a738f0f497da91b25a079cc4ce0689db32da3a3f..aba5a4deec522cb6325ca5a19636047f29e98c92 100644 (file)
@@ -88,17 +88,17 @@ int pem_password_callback(char *buf, int size, int rwflag, void *u);
  * Perform any static initialisation necessary by the library.
  * Called on OpenVPN initialisation
  */
-void tls_init_lib();
+void tls_init_lib(void);
 
 /**
  * Free any global SSL library-specific data structures.
  */
-void tls_free_lib();
+void tls_free_lib(void);
 
 /**
  * Clear the underlying SSL library's error state.
  */
-void tls_clear_error();
+void tls_clear_error(void);
 
 /**
  * Parse a TLS version specifier
index ef583e6799170757c92277f340d04168d174865a..861d936dbd4277d1690124685da2b7505c64f54a 100644 (file)
 #include <mbedtls/sha256.h>
 
 void
-tls_init_lib()
+tls_init_lib(void)
 {
 }
 
 void
-tls_free_lib()
+tls_free_lib(void)
 {
 }
 
 void
-tls_clear_error()
+tls_clear_error(void)
 {
 }
 
index 79947e376859d3d608a1ea4a2d8fa0c5a0d7a2ee..090a66e8171cbe9fce1b1d7b9102b938cc306c7b 100644 (file)
@@ -69,7 +69,7 @@
 int mydata_index; /* GLOBAL */
 
 void
-tls_init_lib()
+tls_init_lib(void)
 {
     SSL_library_init();
 #ifndef ENABLE_SMALL
@@ -82,7 +82,7 @@ tls_init_lib()
 }
 
 void
-tls_free_lib()
+tls_free_lib(void)
 {
     EVP_cleanup();
 #ifndef ENABLE_SMALL
@@ -91,7 +91,7 @@ tls_free_lib()
 }
 
 void
-tls_clear_error()
+tls_clear_error(void)
 {
     ERR_clear_error();
 }
@@ -1329,7 +1329,7 @@ static time_t biofp_last_open;                 /* GLOBAL */
 static const int biofp_reopen_interval = 600;  /* GLOBAL */
 
 static void
-close_biofp()
+close_biofp(void)
 {
     if (biofp)
     {
@@ -1339,7 +1339,7 @@ close_biofp()
 }
 
 static void
-open_biofp()
+open_biofp(void)
 {
     const time_t current = time(NULL);
     const pid_t pid = getpid();
@@ -1775,7 +1775,7 @@ show_available_tls_ciphers(const char *cipher_list)
  * in the OpenSSL library.
  */
 void
-show_available_curves()
+show_available_curves(void)
 {
 #ifndef OPENSSL_NO_EC
     EC_builtin_curve *curves = NULL;
index d0b10bad5174d380a1c64481d5d61afdafd5083c..95fea5dffae5d036b08dc424c96ab70354b8db3d 100644 (file)
@@ -1235,7 +1235,7 @@ set_win_sys_path_via_env(struct env_set *es)
 
 
 const char *
-win_get_tempdir()
+win_get_tempdir(void)
 {
     static char tmpdir[MAX_PATH];
     WCHAR wtmpdir[MAX_PATH];
@@ -1398,7 +1398,7 @@ win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel)
 }
 
 int
-win32_version_info()
+win32_version_info(void)
 {
     if (!IsWindowsXPOrGreater())
     {
@@ -1426,7 +1426,7 @@ win32_version_info()
 }
 
 bool
-win32_is_64bit()
+win32_is_64bit(void)
 {
 #if defined(_WIN64)
     return true;  /* 64-bit programs run only on Win64 */
index 21a1021a1b4a3c12e8a4c93e0c0c0a73dc742223..7fc57ccc408ee9083d915e8fd61fa45963d9a98a 100644 (file)
@@ -285,7 +285,7 @@ char *get_win_sys_path(void);
 void fork_to_self(const char *cmdline);
 
 /* Find temporary directory */
-const char *win_get_tempdir();
+const char *win_get_tempdir(void);
 
 /* Convert a string from UTF-8 to UCS-2 */
 WCHAR *wide_string(const char *utf8, struct gc_arena *gc);
@@ -299,7 +299,7 @@ bool win_wfp_uninit(const NET_IFINDEX index, const HANDLE msg_channel);
 #define WIN_7 2
 #define WIN_8 3
 
-int win32_version_info();
+int win32_version_info(void);
 
 /*
  * String representation of Windows version number and name, see