From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 7599B38A8161 for ; Sat, 8 Oct 2022 04:35:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7599B38A8161 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id CA578300089; Sat, 8 Oct 2022 04:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1665203700; bh=z6I+cWU1H2yp2dH2ZfkDKmoLtNptWcbRIWPdSaqbhRg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Mime-Version:Content-Transfer-Encoding; b=X6jiz5u04C9Hj4euqC9uZpsKEHHI4QKdl5hp5djzjetipsjwPMu8pJEN3i5LXIqy3 3/UTqJ+2TtggcZCX6SxeTYDui6bAJnBILRxPMjLKcqviNWw4DSisJFOctU+2u2DFV/ 7seYZazC1Zv9p6AoclYDrrWq2JZ7+TgyMUIxnTSA= From: Tsukasa OI To: Tsukasa OI , Nelson Chu , Kito Cheng , Palmer Dabbelt Cc: binutils@sourceware.org Subject: [PATCH 3/5] opcodes/riscv-dis.c: Use bool type whenever possible Date: Sat, 8 Oct 2022 04:34:25 +0000 Message-Id: <740bc5e2d2618d236519b39fedd1a1d7ae4e05da.1665203660.git.research_trasio@irq.a4lg.com> In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Before changing the core disassembler, we take care of minor code clarity issues and improve readability. This commit replaces uses of int with bool whenever possible. opcodes/ChangeLog: * riscv-dis.c (no_aliases) Change type to bool. (set_default_riscv_dis_options): Use boolean. (parse_riscv_dis_option_without_args): Likewise. (riscv_disassemble_insn): Use boolean keywords. --- opcodes/riscv-dis.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opcodes/riscv-dis.c b/opcodes/riscv-dis.c index 088d0d91080..608670bed7f 100644 --- a/opcodes/riscv-dis.c +++ b/opcodes/riscv-dis.c @@ -71,7 +71,7 @@ static const char * const *riscv_gpr_names; static const char * const *riscv_fpr_names; /* If set, disassemble as most general instruction. */ -static int no_aliases; +static bool no_aliases = false; /* Set default RISC-V disassembler options. */ @@ -81,7 +81,7 @@ set_default_riscv_dis_options (void) { riscv_gpr_names = riscv_gpr_names_abi; riscv_fpr_names = riscv_fpr_names_abi; - no_aliases = 0; + no_aliases = false; } /* Parse RISC-V disassembler option (without arguments). */ @@ -90,7 +90,7 @@ static bool parse_riscv_dis_option_without_args (const char *option) { if (strcmp (option, "no-aliases") == 0) - no_aliases = 1; + no_aliases = true; else if (strcmp (option, "numeric") == 0) { riscv_gpr_names = riscv_gpr_names_numeric; @@ -645,7 +645,7 @@ static int riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info) { const struct riscv_opcode *op; - static bool init = 0; + static bool init = false; static const struct riscv_opcode *riscv_hash[OP_MASK_OP + 1]; struct riscv_private_data *pd; int insnlen; @@ -659,7 +659,7 @@ riscv_disassemble_insn (bfd_vma memaddr, insn_t word, disassemble_info *info) if (!riscv_hash[OP_HASH_IDX (op->match)]) riscv_hash[OP_HASH_IDX (op->match)] = op; - init = 1; + init = true; } if (info->private_data == NULL) -- 2.34.1