ACK: [PATCH] fwts_args.h: constify read-only function arguments

ivanhu ivan.hu at canonical.com
Mon Apr 12 07:19:41 UTC 2021



On 4/11/21 6:40 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> Make read-only function arguments const. Also re-format prototypes in
> header file fit into 80 columns.
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/include/fwts_args.h | 8 ++++++--
>  src/lib/src/fwts_args.c     | 4 ++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lib/include/fwts_args.h b/src/lib/include/fwts_args.h
> index 8d085e36..0ae222d7 100644
> --- a/src/lib/include/fwts_args.h
> +++ b/src/lib/include/fwts_args.h
> @@ -34,11 +34,15 @@ typedef struct {
>  
>  #include "fwts.h"
>  
> -typedef int (*fwts_args_optarg_handler)(fwts_framework *framework, int argc, char * const argv[], int option_char, int long_index);
> +typedef int (*fwts_args_optarg_handler)(fwts_framework *framework,
> +	const int argc, char * const argv[], const int option_char,
> +	const int long_index);
>  typedef int (*fwts_args_optarg_check)(fwts_framework *framework);
>  
>  int fwts_args_init(void);
> -int fwts_args_add_options(fwts_option *options, fwts_args_optarg_handler handler, fwts_args_optarg_check check);
> +int fwts_args_add_options(fwts_option *options,
> +	const fwts_args_optarg_handler handler,
> +	const fwts_args_optarg_check check);
>  int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[]);
>  void fwts_args_show_options(void);
>  int fwts_args_free(void);
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 4df36334..d399236e 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -67,8 +67,8 @@ int fwts_args_init(void)
>   */
>  int fwts_args_add_options(
>  	fwts_option *options,
> -	fwts_args_optarg_handler handler,
> -	fwts_args_optarg_check check)
> +	const fwts_args_optarg_handler handler,
> +	const fwts_args_optarg_check check)
>  {
>  	int n;
>  	fwts_options_table *options_table;
> 

Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list