|
From: | Richard Henderson |
Subject: | Re: [PATCH v2 6/9] dump: Introduce dump_is_64bit() helper function |
Date: | Fri, 11 Mar 2022 11:47:06 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
On 3/10/22 03:08, Janosch Frank wrote:
Checking d_class in dump_info leads to lengthy conditionals so let's shorten things a bit by introducing a helper function. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> --- dump/dump.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
@@ -1007,7 +1012,7 @@ out:static void write_dump_header(DumpState *s, Error **errp){ - if (s->dump_info.d_class == ELFCLASS32) { + if (!dump_is_64bit(s)) { create_header32(s, errp); } else { create_header64(s, errp); @@ -1697,7 +1702,7 @@ static void dump_init(DumpState *s, int fd, bool has_format, uint32_t size; uint16_t format;- note_head_size = s->dump_info.d_class == ELFCLASS32 ?+ note_head_size = !dump_is_64bit(s) ? sizeof(Elf32_Nhdr) : sizeof(Elf64_Nhdr);
It would be nice to standardize on positive tests, which in this case would reverse these two conditionals.
r~
[Prev in Thread] | Current Thread | [Next in Thread] |