From patchwork Tue Oct 16 19:20:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [04/11] lib: fwts_args: constify func arguments where appropriate From: Colin King X-Patchwork-Id: 191858 Message-Id: <1350415248-16965-5-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com Date: Tue, 16 Oct 2012 20:20:41 +0100 From: Colin Ian King Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Ivan Hu --- 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;