This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: rel/rela patch for get_dynamic_reloc_section_name
- From: Bernd Schmidt <bernds at codesourcery dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 22 Feb 2011 16:40:50 +0100
- Subject: Re: rel/rela patch for get_dynamic_reloc_section_name
- References: <4D5B6099.1040809@codesourcery.com> <4D63D6DA.7030204@redhat.com>
On 02/22/2011 04:31 PM, Nick Clifton wrote:
> Hi Bernd,
>
> + name = bfd_alloc (abfd, (is_rela ? 6 : 5) + strlen (old_name));
> + if (is_rela)
> + strcpy (name, ".rela");
> + else
> + strcpy (name, ".rel");
> + strcat (name, old_name);
>
> I dislike seeing magic constants like "6" and "5" in the code above. How
> about rewriting this as:
>
> const char * prefix = is_rela ? ".rela" : ".rel";
> name = bfd_alloc (abfd, strlen (prefix) + strlen (old_name) + 1);
> sprintf (name, "%s%s", prefix, old_name);
Ok with that change?
Bernd