From patchwork Wed Aug 6 12:42:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 2324 Received: (qmail 32381 invoked by alias); 6 Aug 2014 12:42:14 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 32363 invoked by uid 89); 6 Aug 2014 12:42:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Aug 2014 12:42:11 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s76CgATZ010111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 6 Aug 2014 08:42:10 -0400 Received: from blade.nx (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s76Cg9O6012755 for ; Wed, 6 Aug 2014 08:42:09 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 9A2392640D4 for ; Wed, 6 Aug 2014 13:42:08 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH] Rearrange awkwardly-nested conditionals Date: Wed, 6 Aug 2014 13:42:08 +0100 Message-Id: <1407328928-11952-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes 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 * regcache.c (init_register_cache): Move conditionals inside if. --- gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/regcache.c | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index bed10b4..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;