Re: [PATCH 4/7] lib: fix empty arg function prototypes

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Thu, Feb 06, 2025 at 03:19:59PM -0600, Eric Sandeen wrote:
> Several function prototypes used () when in fact they take
> arguments. Fix those to make sparse happy.
> 
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> ---
>  include/random_range.h | 2 +-
>  include/write_log.h    | 2 +-
>  lib/random_range.c     | 6 ++----
>  lib/string_to_tokens.c | 1 -
>  lib/tlibio.c           | 2 +-
>  lib/write_log.c        | 2 +-
>  6 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/include/random_range.h b/include/random_range.h
> index b47aef9e..c352c5a9 100644
> --- a/include/random_range.h
> +++ b/include/random_range.h
> @@ -6,7 +6,7 @@
>  #ifndef _RANDOM_RANGE_H_
>  #define _RANDOM_RANGE_H_
>  
> -int       parse_ranges     ( char *, int, int, int, int (*)(), char **, char ** );
> +int       parse_ranges     ( char *, int, int, int, int (*)(char *, int *), char **, char ** );
>  int       range_min        ( char *, int );
>  int       range_max        ( char *, int );
>  int       range_mult       ( char *, int );
> diff --git a/include/write_log.h b/include/write_log.h
> index 025ebac0..d02f898a 100644
> --- a/include/write_log.h
> +++ b/include/write_log.h
> @@ -125,7 +125,7 @@ extern int	wlog_close(struct wlog_file *wfile);
>  extern int	wlog_record_write(struct wlog_file *wfile,
>  				  struct wlog_rec *wrec, long offset);
>  extern int	wlog_scan_backward(struct wlog_file *wfile, int nrecs,
> -				   int (*func)(struct wlog_rec *rec),
> +				   int (*func)(struct wlog_rec *rec, long data),

This is a very similar version to what's in
testcases/kernel/fs/doio/write_log.c in the LTP source.

Maybe it's time to clean up both versions?

Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>

--D

>  				   long data);
>  #else
>  int	wlog_open();
> diff --git a/lib/random_range.c b/lib/random_range.c
> index 680bf71c..0b38eb7f 100644
> --- a/lib/random_range.c
> +++ b/lib/random_range.c
> @@ -69,7 +69,7 @@ struct range {
>   * parse_range() returns -1 on error, or the number of ranges parsed.
>   */
>  
> -static int       str_to_int();
> +static int       str_to_int(char *str, int *ip);
>  static long long divider(long long, long long, long long, long long);
>  
>  int
> @@ -78,7 +78,7 @@ parse_ranges(
>  	int defmin,
>  	int defmax,
>  	int defmult,
> -	int (*parse_func)(),
> +	int (*parse_func)(char *str, int *ip),
>  	char **rangeptr,
>  	char **errptr)
>  {
> @@ -570,8 +570,6 @@ printf("   diff = %lld, half = %lld,   med = %lld\n", diff, half, med);
>  void
>  random_range_seed(long s)
>  {
> -    extern void srand48();
> -
>      srand48(s);
>  }
>  
> diff --git a/lib/string_to_tokens.c b/lib/string_to_tokens.c
> index 08df9fcc..8383ed4c 100644
> --- a/lib/string_to_tokens.c
> +++ b/lib/string_to_tokens.c
> @@ -54,7 +54,6 @@ int
>  string_to_tokens(char *arg_string, char *arg_array[], int array_size, char *separator)
>  {
>     int num_toks = 0;  /* number of tokens found */
> -   char *strtok();
>  	
>     if ( arg_array == NULL || array_size <= 1 || separator == NULL )
>  	return -1;
> diff --git a/lib/tlibio.c b/lib/tlibio.c
> index 3c23bf4d..19192b38 100644
> --- a/lib/tlibio.c
> +++ b/lib/tlibio.c
> @@ -75,7 +75,7 @@
>  
>  
>  #ifndef linux
> -static void lio_async_signal_handler();
> +static void lio_async_signal_handler(int sig);
>  #endif
>  
>  /*
> diff --git a/lib/write_log.c b/lib/write_log.c
> index c82cc1f4..e04fed4b 100644
> --- a/lib/write_log.c
> +++ b/lib/write_log.c
> @@ -217,7 +217,7 @@ int
>  wlog_scan_backward(
>  	struct wlog_file	*wfile,
>  	int 			nrecs,
> -	int 			(*func)(),
> +	int 			(*func)(struct wlog_rec *, long data),
>  	long			data)
>  {
>  	int			fd, leftover, nbytes, offset, recnum, reclen;
> -- 
> 2.48.0
> 
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux