This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] objcopy: Avoid shadowing optarg.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=06b73f4199944fb8a7d2c8874f91ed1deb7f4c44

commit 06b73f4199944fb8a7d2c8874f91ed1deb7f4c44
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Thu Feb 26 17:17:46 2015 +0000

    objcopy: Avoid shadowing optarg.
    
    In commit 7173b38a442c007a554ea200817a0eadce89c87b I used optarg as the
    name for a function parameter, shadowing the global of that name.  This
    commit changes the function parameter to be called arg.
    
    binutils/ChangeLog:
    
    	* objcopy.c (init_section_add): Rename optarg to arg in order to
    	avoid shadowing a global variable.

Diff:
---
 binutils/ChangeLog | 5 +++++
 binutils/objcopy.c | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3a42b72..6caa4fa 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-26  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* objcopy.c (init_section_add): Rename optarg to arg in order to
+	avoid shadowing a global variable.
+
 2015-02-26  Nick Clifton  <nickc@redhat.com>
 
 	PR binutils/17512
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 5cb4b13..7f094d3 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3547,25 +3547,25 @@ convert_efi_target (char *efi)
 }
 
 /* Allocate and return a pointer to a struct section_add, initializing the
-   structure using OPTARG, a string in the format "sectionname=filename".
+   structure using ARG, a string in the format "sectionname=filename".
    The returned structure will have its next pointer set to NEXT.  The
    OPTION field is the name of the command line option currently being
    parsed, and is only used if an error needs to be reported.  */
 
 static struct section_add *
-init_section_add (const char *optarg,
+init_section_add (const char *arg,
                   struct section_add *next,
                   const char *option)
 {
   struct section_add *pa;
   const char *s;
 
-  s = strchr (optarg, '=');
+  s = strchr (arg, '=');
   if (s == NULL)
     fatal (_("bad format for %s"), option);
 
   pa = (struct section_add *) xmalloc (sizeof (struct section_add));
-  pa->name = xstrndup (optarg, s - optarg);
+  pa->name = xstrndup (arg, s - arg);
   pa->filename = s + 1;
   pa->next = next;
   pa->contents = NULL;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]