aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/regcache.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-08-06 13:39:39 +0100
committerGary Benson <gbenson@redhat.com>2014-08-06 13:39:39 +0100
commit87f6c4e3e64fe41df2afc45745437e7584fd97f4 (patch)
tree7b5181ce23eb756e3f953f831a6fe754c64a9c67 /gdb/gdbserver/regcache.c
parentaf19829b117d124842b41da499b3161690bbca1a (diff)
downloadgdb-87f6c4e3e64fe41df2afc45745437e7584fd97f4.zip
gdb-87f6c4e3e64fe41df2afc45745437e7584fd97f4.tar.gz
gdb-87f6c4e3e64fe41df2afc45745437e7584fd97f4.tar.bz2
Rearrange awkwardly-nested conditionals
gdbserver's init_register_cache has some preprocessor conditionals awkwardly nested around an if..else block. This commit moves the conditionals inside the braces to make the code more readable. gdb/gdbserver/ 2014-08-06 Gary Benson <gbenson@redhat.com> * regcache.c (init_register_cache): Move conditionals inside if.
Diffstat (limited to 'gdb/gdbserver/regcache.c')
-rw-r--r--gdb/gdbserver/regcache.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index bed10b48..db99f8c 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -117,9 +117,9 @@ init_register_cache (struct regcache *regcache,
const struct target_desc *tdesc,
unsigned char *regbuf)
{
-#ifndef IN_PROCESS_AGENT
if (regbuf == NULL)
{
+#ifndef IN_PROCESS_AGENT
/* Make sure to zero-initialize the register cache when it is
created, in case there are registers the target never
fetches. This way they'll read as zero instead of
@@ -129,13 +129,11 @@ init_register_cache (struct regcache *regcache,
regcache->registers_owned = 1;
regcache->register_status = xcalloc (1, tdesc->num_registers);
gdb_assert (REG_UNAVAILABLE == 0);
- }
- else
#else
- if (regbuf == NULL)
- fatal ("init_register_cache: can't allocate memory from the heap");
- else
+ fatal ("init_register_cache: can't allocate memory from the heap");
#endif
+ }
+ else
{
regcache->tdesc = tdesc;
regcache->registers = regbuf;