[PATCH 04/11] lib: fwts_args: constify func arguments where appropriate

Keng-Yu Lin kengyu at canonical.com
Thu Oct 18 06:48:18 UTC 2012


On Wed, Oct 17, 2012 at 3:20 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/include/fwts_args.h |    2 +-
>  src/lib/src/fwts_args.c     |   14 ++++++++++----
>  2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/src/lib/include/fwts_args.h b/src/lib/include/fwts_args.h
> index 8f55807..b3ef89a 100644
> --- a/src/lib/include/fwts_args.h
> +++ b/src/lib/include/fwts_args.h
> @@ -39,7 +39,7 @@ 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_parse(fwts_framework *fw, int argc, char * const argv[]);
> +int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[]);
>  void fwts_args_show_options(void);
>  int fwts_args_free(void);
>  char *fwts_args_comma_list(const char *arg);
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index a0dc5af..f2038ac 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -32,7 +32,7 @@
>   *  of how many options there are in each table.
>   */
>  typedef struct {
> -       fwts_option     *options;               /* options array */
> +       fwts_option *options;                   /* options array */
>         int             num_options;            /* number of options */
>         fwts_args_optarg_handler optarg_handler;/* options handler */
>         fwts_args_optarg_check   optarg_check;  /* options checker */
> @@ -61,7 +61,10 @@ int fwts_args_init(void)
>   *  fwts_args_add_options()
>   *     add a table of options and handler for these options
>   */
> -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,
> +       fwts_args_optarg_handler handler,
> +       fwts_args_optarg_check check)
>  {
>         int n;
>         fwts_options_table *options_table;
> @@ -90,7 +93,7 @@ int fwts_args_add_options(fwts_option *options, fwts_args_optarg_handler handler
>   *  fwts_args_parse()
>   *     parse options
>   */
> -int fwts_args_parse(fwts_framework *fw, int argc, char * const argv[])
> +int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[])
>  {
>         fwts_list_link *item;
>         fwts_options_table *options_table;
> @@ -219,7 +222,10 @@ static int fwts_args_compare_options(void *data1, void *data2)
>   *  fwts_args_show_option()
>   *     pretty print an option
>   */
> -void fwts_args_show_option(int width, char *option, char *explanation)
> +static void fwts_args_show_option(
> +       const int width,
> +       const char *option,
> +       const char *explanation)
>  {
>         fwts_list *text;
>         fwts_list_link *item;
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list