changeset 2425:85b6d7ce8ca5

Rename some variables.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Jan 2020 05:00:05 +0200
parents 3b28868475e8
children bb7264ddaefd
files src/dmargs.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmargs.c	Mon Jan 20 19:29:03 2020 +0200
+++ b/src/dmargs.c	Tue Jan 21 05:00:05 2020 +0200
@@ -19,7 +19,7 @@
  * @param opts options list array
  * @param nopts number of elements in options list array
  * @param handle_option function pointer to callback that handles option arguments
- * @param doProcess if TRUE, actually handle the argument, aka call the handle_option() function. if FALSE, only validity of options are checked.
+ * @param process if TRUE, actually handle the argument, aka call the handle_option() function. if FALSE, only validity of options are checked.
  * @param isLong TRUE if the option is a --long-format one
  */
 static BOOL dmArgsProcessOpt(
@@ -27,13 +27,12 @@
     int argc, char *argv[],
     const DMOptArg opts[], int nopts,
     BOOL (*handle_option)(int id, char *, char *),
-    BOOL doProcess, BOOL isLong)
+    BOOL process, BOOL isLong)
 {
     const DMOptArg *opt = NULL;
     char *optArg = NULL;
-    int optIndex;
 
-    for (optIndex = 0; optIndex < nopts; optIndex++)
+    for (int optIndex = 0; optIndex < nopts; optIndex++)
     {
         const DMOptArg *node = &opts[optIndex];
         if (isLong && node->o_long != NULL)
@@ -86,7 +85,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
@@ -121,16 +120,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++;
@@ -151,7 +150,7 @@
                 isLong = FALSE;
 
             if (!dmArgsProcessOpt(str, &argIndex, argc, argv,
-                opts, nopts, handle_option, doProcess, isLong))
+                opts, nopts, handle_option, process, isLong))
                 optionsOK = FALSE;
         }
         else