aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Muller <muller@sourceware.org>2011-04-19 07:16:42 +0000
committerPierre Muller <muller@sourceware.org>2011-04-19 07:16:42 +0000
commit1448a0a258317fbe7566a0a3f48970b2a5b3912e (patch)
treeaf4e3ce40b911ae7231ed9ec98bbf9ee3742bf57 /gdb/xtensa-tdep.c
parent*** empty log message *** (diff)
downloadbinutils-gdb-1448a0a258317fbe7566a0a3f48970b2a5b3912e.tar.gz
binutils-gdb-1448a0a258317fbe7566a0a3f48970b2a5b3912e.tar.bz2
binutils-gdb-1448a0a258317fbe7566a0a3f48970b2a5b3912e.zip
ARI cleanup.
* xtensa-tdep.c (xtensa_register_type): Use xstrprintf instead of sprintf. Simplify code and avoid loosing memory. (xtensa_register_reggroup_p): Extract assignment out of IF clause. (call0_frame_cache): Remove && operator from end of line.
Diffstat (limited to 'gdb/xtensa-tdep.c')
-rw-r--r--gdb/xtensa-tdep.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 24cc79c42bd..518b77b85de 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -318,15 +318,14 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
if (tp == NULL)
{
- char *name = xmalloc (16);
+ char *name = xstrprintf ("int%d", size * 8);
tp = xmalloc (sizeof (struct ctype_cache));
tp->next = tdep->type_entries;
tdep->type_entries = tp;
tp->size = size;
-
- sprintf (name, "int%d", size * 8);
tp->virtual_type
- = arch_integer_type (gdbarch, size * 8, 1, xstrdup (name));
+ = arch_integer_type (gdbarch, size * 8, 1, name);
+ xfree (name);
}
reg->ctype = tp->virtual_type;
@@ -843,7 +842,8 @@ xtensa_register_reggroup_p (struct gdbarch *gdbarch,
if (group == restore_reggroup)
return (regnum < gdbarch_num_regs (gdbarch)
&& (reg->flags & SAVE_REST_FLAGS) == SAVE_REST_VALID);
- if ((cp_number = xtensa_coprocessor_register_group (group)) >= 0)
+ cp_number = xtensa_coprocessor_register_group (group);
+ if (cp_number >= 0)
return rg & (xtRegisterGroupCP0 << cp_number);
else
return 1;
@@ -2715,9 +2715,9 @@ call0_frame_cache (struct frame_info *this_frame,
too bad. */
int i;
- for (i = 0;
- (i < C0_NREGS) &&
- (i == C0_RA || cache->c0.c0_rt[i].fr_reg != C0_RA);
+ for (i = 0;
+ (i < C0_NREGS)
+ && (i == C0_RA || cache->c0.c0_rt[i].fr_reg != C0_RA);
++i);
if (i >= C0_NREGS && cache->c0.c0_rt[C0_RA].fr_reg == C0_RA)
i = C0_RA;