Remove magic numbers in m68k-dis.c:print_insn_arg
authorYao Qi <yao.qi@linaro.org>
Fri, 13 Jan 2017 12:21:22 +0000 (12:21 +0000)
committerYao Qi <yao.qi@linaro.org>
Fri, 13 Jan 2017 12:21:22 +0000 (12:21 +0000)
commitf622ea96de49d77646f52501ef00d03132fcb2df
tree865e9139caa81146f81ad933efc89744d4eca402
parent404c84343097091e21090727948d1461bf316118
Remove magic numbers in m68k-dis.c:print_insn_arg

When I inspect the return values of disassmblers, I happen to see
various -1/-2/-3 magic numbers are used in m68k-dis.c.  This patch
is to replace them with enum.

-1 and -2 is "clearly documented" in print_ins_arg's comments, but
-3 isn't.  In fact, -3 is returned when FETCH_DATA returns false,
which means memory error (because fetch_data return 0 on memory
error).  So I name enum PRINT_INSN_ARG_MEMORY_ERROR for -3.

This patch is a refactor patch, doesn't affect any functionality.

opcodes:

2017-01-13  Yao Qi  <yao.qi@linaro.org>

* m68k-dis.c (enum print_insn_arg_error): New.
(NEXTBYTE): Replace -3 with
PRINT_INSN_ARG_MEMORY_ERROR.
(NEXTULONG): Likewise.
(NEXTSINGLE): Likewise.
(NEXTDOUBLE): Likewise.
(NEXTDOUBLE): Likewise.
(NEXTPACKED): Likewise.
(FETCH_ARG): Likewise.
(FETCH_DATA): Update comments.
(print_insn_arg): Update comments. Replace magic numbers with
enum.
(match_insn_m68k): Likewise.
opcodes/ChangeLog
opcodes/m68k-dis.c
This page took 0.024599 seconds and 4 git commands to generate.