summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTsukasa OI <research_trasio@irq.a4lg.com>2022-08-27 13:09:06 +0000
committerTsukasa OI <research_trasio@irq.a4lg.com>2022-10-14 05:21:41 +0000
commit354c1c098abe2b5cbc9da9751d29c5e5a0072376 (patch)
treefed127cf231fc94486f050d38928d1eb0c2c552b
parent1469f944d1d3f6c0f94c15716fdb74f9240a5136 (diff)
downloadbinutils-gdb-354c1c098abe2b5cbc9da9751d29c5e5a0072376.tar.gz
opcodes/riscv-dis.c: Use bool type whenever possible
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.
-rw-r--r--opcodes/riscv-dis.c10
1 files 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)