Rearrange awkwardly-nested conditionals
authorGary Benson <gbenson@redhat.com>
Wed, 6 Aug 2014 12:39:39 +0000 (13:39 +0100)
committerGary Benson <gbenson@redhat.com>
Wed, 6 Aug 2014 12:39:39 +0000 (13:39 +0100)
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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/regcache.c

index 632fcca13a1f40e31a24420c7a0368f7c34055a7..450862182f3afd6858041e7b76f25b1e55e3cc55 100644 (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>
 
        * linux-low.c (linux_supports_non_stop): Use target_is_async_p.
index bed10b48a0e75f720d3a9c9325a0693bc64e06d2..db99f8c0fa9b85809c63f8a78f4d8b7eef8b7860 100644 (file)
@@ -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;
This page took 0.035124 seconds and 4 git commands to generate.