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.
This commit is contained in:
Gary Benson
2014-08-06 13:39:39 +01:00
parent af19829b11
commit 87f6c4e3e6
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2014-08-06 Gary Benson <gbenson@redhat.com>
* regcache.c (init_register_cache): Move conditionals inside if.
2014-08-06 Gary Benson <gbenson@redhat.com> 2014-08-06 Gary Benson <gbenson@redhat.com>
* linux-low.c (linux_supports_non_stop): Use target_is_async_p. * linux-low.c (linux_supports_non_stop): Use target_is_async_p.

View File

@ -117,9 +117,9 @@ init_register_cache (struct regcache *regcache,
const struct target_desc *tdesc, const struct target_desc *tdesc,
unsigned char *regbuf) unsigned char *regbuf)
{ {
#ifndef IN_PROCESS_AGENT
if (regbuf == NULL) if (regbuf == NULL)
{ {
#ifndef IN_PROCESS_AGENT
/* Make sure to zero-initialize the register cache when it is /* Make sure to zero-initialize the register cache when it is
created, in case there are registers the target never created, in case there are registers the target never
fetches. This way they'll read as zero instead of 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->registers_owned = 1;
regcache->register_status = xcalloc (1, tdesc->num_registers); regcache->register_status = xcalloc (1, tdesc->num_registers);
gdb_assert (REG_UNAVAILABLE == 0); gdb_assert (REG_UNAVAILABLE == 0);
#else
fatal ("init_register_cache: can't allocate memory from the heap");
#endif
} }
else else
#else
if (regbuf == NULL)
fatal ("init_register_cache: can't allocate memory from the heap");
else
#endif
{ {
regcache->tdesc = tdesc; regcache->tdesc = tdesc;
regcache->registers = regbuf; regcache->registers = regbuf;