From: Mike Frysinger Date: Sun, 1 Apr 2012 04:15:43 +0000 (+0000) Subject: opcodes: bfin: simplify field width processing and fix build warnings X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5de10af023f4409d36481733610ed7e9c2fcb8b6;p=deliverable%2Fbinutils-gdb.git opcodes: bfin: simplify field width processing and fix build warnings This fix the build time warning: warning: format not a string literal, argument types not checked [-Wformat-nonliteral] Signed-off-by: Mike Frysinger --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index a7264990c2..0dec560ca4 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2012-04-01 Mike Frysinger + + * bfin-dis.c (fmtconst): Replace decimal handling with a single + sprintf call and the '*' field width. + 2012-03-23 Maxim Kuvyrkov * mips-dis.c (mips_arch_choices): Add entry for Broadcom XLP. diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c index 130dfc7719..7470ebdc2a 100644 --- a/opcodes/bfin-dis.c +++ b/opcodes/bfin-dis.c @@ -162,16 +162,7 @@ fmtconst (const_forms_t cf, TIword x, bfd_vma pc, disassemble_info *outf) x <<= constant_formats[cf].scale; if (constant_formats[cf].decimal) - { - if (constant_formats[cf].leading) - { - char ps[10]; - sprintf (ps, "%%%ii", constant_formats[cf].leading); - sprintf (buf, ps, x); - } - else - sprintf (buf, "%li", x); - } + sprintf (buf, "%*li", constant_formats[cf].leading, x); else { if (constant_formats[cf].issigned && x < 0)