# HG changeset patch # User Matti Hamalainen # Date 1579575653 -7200 # Node ID c09b068ecb3277053f002ded936956e68f900c17 # Parent e3c4d8e286957d67352f5c982263aec7b0c8e4f8 Rename some variables. diff -r e3c4d8e28695 -r c09b068ecb32 th_args.c --- a/th_args.c Mon Jan 20 17:02:06 2020 +0200 +++ b/th_args.c Tue Jan 21 05:00:53 2020 +0200 @@ -19,7 +19,7 @@ * @param[in] opts options list array * @param[in] nopts number of elements in options list array * @param[in] handle_option function pointer to callback that handles option arguments - * @param[in] doProcess if TRUE, actually handle the argument, aka call the handle_option() function. if FALSE, only validity of options are checked. + * @param[in] process if TRUE, actually handle the argument, aka call the handle_option() function. if FALSE, only validity of options are checked. * @param[in] isLong TRUE if the option is a --long-format one * @returns returns @c TRUE if option processing was successful */ @@ -28,13 +28,12 @@ int argc, char *argv[], const th_optarg opts[], int nopts, BOOL (*handle_option)(int id, char *, char *), - BOOL doProcess, BOOL isLong) + BOOL process, BOOL isLong) { const th_optarg *opt = NULL; char *optArg = NULL; - int optIndex; - for (optIndex = 0; optIndex < nopts; optIndex++) + for (int optIndex = 0; optIndex < nopts; optIndex++) { const th_optarg *node = &opts[optIndex]; if (isLong && node->o_long != NULL) @@ -87,7 +86,7 @@ } // Option was given succesfully, try to process it - if (doProcess && !handle_option(opt->id, optArg, currArg)) + if (process && !handle_option(opt->id, optArg, currArg)) return FALSE; } else @@ -122,16 +121,16 @@ BOOL(*handle_option)(int id, char *, char *), BOOL(*handle_other)(char *), const int flags) { - int argIndex, handleFlags = flags & OPTH_ONLY_MASK; + int handleFlags = flags & OPTH_ONLY_MASK; BOOL optionsOK = TRUE, endOfOptions = FALSE; - for (argIndex = 1; argIndex < argc; argIndex++) + for (int argIndex = 1; argIndex < argc; argIndex++) { char *str = argv[argIndex]; if (*str == '-' && !endOfOptions) { // Should we process options? - BOOL doProcess = (handleFlags & OPTH_ONLY_OPTS) || handleFlags == 0; + BOOL process = (handleFlags & OPTH_ONLY_OPTS) || handleFlags == 0; BOOL isLong; str++; @@ -152,7 +151,7 @@ isLong = FALSE; if (!th_args_process_opt(str, &argIndex, argc, argv, - opts, nopts, handle_option, doProcess, isLong)) + opts, nopts, handle_option, process, isLong)) optionsOK = FALSE; } else