[COMMITTED PATCH] avoid addition to string literal in readelf.c

Roland McGrath mcgrathr@google.com
Fri Oct 11 17:12:00 GMT 2013


Committed as obvious enough, to trunk and 2.24 branch.
(I am not a C++ ninny, but I have always found &array[n]
the more natural thing to write than array + n.)


Thanks,
Roland


binutils/
2013-10-11  Roland McGrath  <mcgrathr@google.com>

	* readelf.c (print_dynamic_symbol): Use array subscript syntax
	rather than addition syntax with string literal.

--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9319,7 +9319,7 @@ print_dynamic_symbol (bfd_vma si, unsigned long hn)

   n = print_vma (si, DEC_5);
   if (n < 5)
-    fputs ("     " + n, stdout);
+    fputs (&"     "[n], stdout);
   printf (" %3lu: ", hn);
   print_vma (psym->st_value, LONG_HEX);
   putchar (' ');



More information about the Binutils mailing list