Updated Portuguese translation for the BFD sub-directory
[binutils-gdb.git] / gdbsupport / common-inferior.cc
index aa8be14c742677f2ace41dea5f87cf2522d30c22..aed88409909bf90e65953a590892dab17ac54c37 100644 (file)
@@ -1,7 +1,7 @@
 /* Functions to deal with the inferior being executed on GDB or
    GDBserver.
 
-   Copyright (C) 2019-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -28,10 +28,8 @@ bool startup_with_shell = true;
 /* See common-inferior.h.  */
 
 std::string
-construct_inferior_arguments (int argc, char * const *argv)
+construct_inferior_arguments (gdb::array_view<char * const> argv)
 {
-  gdb_assert (argc >= 0);
-
   std::string result;
 
   if (startup_with_shell)
@@ -48,7 +46,7 @@ construct_inferior_arguments (int argc, char * const *argv)
       static const char special[] = "\"!#$&*()\\|[]{}<>?'`~^; \t\n";
       static const char quote = '\'';
 #endif
-      for (int i = 0; i < argc; ++i)
+      for (int i = 0; i < argv.size (); ++i)
        {
          if (i > 0)
            result += ' ';
@@ -103,19 +101,19 @@ construct_inferior_arguments (int argc, char * const *argv)
     {
       /* In this case we can't handle arguments that contain spaces,
         tabs, or newlines -- see breakup_args().  */
-      for (int i = 0; i < argc; ++i)
+      for (char *arg : argv)
        {
-         char *cp = strchr (argv[i], ' ');
+         char *cp = strchr (arg, ' ');
          if (cp == NULL)
-           cp = strchr (argv[i], '\t');
+           cp = strchr (arg, '\t');
          if (cp == NULL)
-           cp = strchr (argv[i], '\n');
+           cp = strchr (arg, '\n');
          if (cp != NULL)
            error (_("can't handle command-line "
                     "argument containing whitespace"));
        }
 
-      for (int i = 0; i < argc; ++i)
+      for (int i = 0; i < argv.size (); ++i)
        {
          if (i > 0)
            result += " ";