diff mbox

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

Message ID 1350415248-16965-5-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Oct. 16, 2012, 7:20 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts_args.h |    2 +-
 src/lib/src/fwts_args.c     |   14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

Comments

Keng-Yu Lin Oct. 18, 2012, 6:48 a.m. UTC | #1
On Wed, Oct 17, 2012 at 3:20 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@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@canonical.com>
Ivan Hu Oct. 22, 2012, 9:32 a.m. UTC | #2
On 10/17/2012 03:20 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@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;
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

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;