Re: [Openvpn-devel] [PATCH 1/5] make function declarations C99 compliant

2017-08-11 Thread Steffan Karger
On 11-08-17 11:07, Antonio Quartulli wrote:
> From: Antonio Quartulli 
> 
> 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 
> ---
>  src/openvpn/buffer.c  |  2 +-
>  src/openvpn/console.c |  2 +-
>  src/openvpn/console.h |  8 
>  src/openvpn/console_builtin.c |  2 +-
>  src/openvpn/console_systemd.c |  4 ++--
>  src/openvpn/crypto.c  |  4 ++--
>  src/openvpn/crypto.h  |  2 +-
>  src/openvpn/crypto_mbedtls.c  | 10 +-
>  src/openvpn/crypto_mbedtls.h  |  4 ++--
>  src/openvpn/crypto_openssl.c  |  6 +++---
>  src/openvpn/error.c   |  6 +++---
>  src/openvpn/error.h   |  2 +-
>  src/openvpn/init.c|  2 +-
>  src/openvpn/interval.h|  2 +-
>  src/openvpn/manage.c  |  2 +-
>  src/openvpn/occ-inline.h  |  2 +-
>  src/openvpn/packet_id.c   |  2 +-
>  src/openvpn/packet_id.h   |  2 +-
>  src/openvpn/pkcs11.c  |  6 +++---
>  src/openvpn/platform.c|  2 +-
>  src/openvpn/ps.c  |  2 +-
>  src/openvpn/ssl.c |  4 ++--
>  src/openvpn/ssl_backend.h |  6 +++---
>  src/openvpn/ssl_mbedtls.c |  6 +++---
>  src/openvpn/ssl_openssl.c | 12 ++--
>  src/openvpn/win32.c   |  6 +++---
>  src/openvpn/win32.h   |  4 ++--
>  27 files changed, 56 insertions(+), 56 deletions(-)
> 
> diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
> index 87e27ec0..a63ce14a 100644
> --- a/src/openvpn/buffer.c
> +++ b/src/openvpn/buffer.c
> @@ -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);
> diff --git a/src/openvpn/console.c b/src/openvpn/console.c
> index eb6944d0..7e170241 100644
> --- a/src/openvpn/console.c
> +++ b/src/openvpn/console.c
> @@ -44,7 +44,7 @@ struct _query_user query_user[QUERY_USER_NUMSLOTS];  /* 
> GLOBAL */
>  
>  
>  void
> -query_user_clear()
> +query_user_clear(void)
>  {
>  int i;
>  
> diff --git a/src/openvpn/console.h b/src/openvpn/console.h
> index aa51e6f6..3f74e77e 100644
> --- a/src/openvpn/console.h
> +++ b/src/openvpn/console.h
> @@ -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();
>  }
> diff --git a/src/openvpn/console_builtin.c b/src/openvpn/console_builtin.c
> index 7b95da9d..f005ed74 100644
> --- a/src/openvpn/console_builtin.c
> +++ b/src/openvpn/console_builtin.c
> @@ -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;
> diff --git a/src/openvpn/console_systemd.c b/src/openvpn/console_systemd.c
> index 8cee8c8e..e7a72ae3 100644
> --- a/src/openvpn/console_systemd.c
> +++ b/src/openvpn/console_systemd.c
> @@ -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;
> diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
> index 909e901f..692501d2 100644
> --- a/src/openvpn/crypto.c
> +++ b/src/openvpn/crypto.c
> @@ -1715,7 +1715,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 */
> @@ -1799,7 +1799,7 @@ prng_bytes(uint8_t *output, int len)
>  

[Openvpn-devel] [PATCH 1/5] make function declarations C99 compliant

2017-08-11 Thread Antonio Quartulli
From: Antonio Quartulli 

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 
---
 src/openvpn/buffer.c  |  2 +-
 src/openvpn/console.c |  2 +-
 src/openvpn/console.h |  8 
 src/openvpn/console_builtin.c |  2 +-
 src/openvpn/console_systemd.c |  4 ++--
 src/openvpn/crypto.c  |  4 ++--
 src/openvpn/crypto.h  |  2 +-
 src/openvpn/crypto_mbedtls.c  | 10 +-
 src/openvpn/crypto_mbedtls.h  |  4 ++--
 src/openvpn/crypto_openssl.c  |  6 +++---
 src/openvpn/error.c   |  6 +++---
 src/openvpn/error.h   |  2 +-
 src/openvpn/init.c|  2 +-
 src/openvpn/interval.h|  2 +-
 src/openvpn/manage.c  |  2 +-
 src/openvpn/occ-inline.h  |  2 +-
 src/openvpn/packet_id.c   |  2 +-
 src/openvpn/packet_id.h   |  2 +-
 src/openvpn/pkcs11.c  |  6 +++---
 src/openvpn/platform.c|  2 +-
 src/openvpn/ps.c  |  2 +-
 src/openvpn/ssl.c |  4 ++--
 src/openvpn/ssl_backend.h |  6 +++---
 src/openvpn/ssl_mbedtls.c |  6 +++---
 src/openvpn/ssl_openssl.c | 12 ++--
 src/openvpn/win32.c   |  6 +++---
 src/openvpn/win32.h   |  4 ++--
 27 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c
index 87e27ec0..a63ce14a 100644
--- a/src/openvpn/buffer.c
+++ b/src/openvpn/buffer.c
@@ -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);
diff --git a/src/openvpn/console.c b/src/openvpn/console.c
index eb6944d0..7e170241 100644
--- a/src/openvpn/console.c
+++ b/src/openvpn/console.c
@@ -44,7 +44,7 @@ struct _query_user query_user[QUERY_USER_NUMSLOTS];  /* 
GLOBAL */
 
 
 void
-query_user_clear()
+query_user_clear(void)
 {
 int i;
 
diff --git a/src/openvpn/console.h b/src/openvpn/console.h
index aa51e6f6..3f74e77e 100644
--- a/src/openvpn/console.h
+++ b/src/openvpn/console.h
@@ -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();
 }
diff --git a/src/openvpn/console_builtin.c b/src/openvpn/console_builtin.c
index 7b95da9d..f005ed74 100644
--- a/src/openvpn/console_builtin.c
+++ b/src/openvpn/console_builtin.c
@@ -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;
diff --git a/src/openvpn/console_systemd.c b/src/openvpn/console_systemd.c
index 8cee8c8e..e7a72ae3 100644
--- a/src/openvpn/console_systemd.c
+++ b/src/openvpn/console_systemd.c
@@ -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;
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 909e901f..692501d2 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -1715,7 +1715,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 */
@@ -1799,7 +1799,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));
diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h
index f00a6d8f..f1b6c20a 100644
--- a/src/openvpn/crypto.h
+++ b/src/openvpn/crypto.h
@@ -465,7 +465,7 @@ void prng_init(const char *md_