changeset 634:c09b068ecb32

Rename some variables.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Jan 2020 05:00:53 +0200
parents e3c4d8e28695
children d191ded8a790
files th_args.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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