From: Florian K. <fk...@so...> - 2025-04-11 11:57:39
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e4fa98e0eac13b9c1333711288af707cb4dccd10 commit e4fa98e0eac13b9c1333711288af707cb4dccd10 Author: Florian Krohm <fl...@ei...> Date: Fri Apr 11 11:55:24 2025 +0000 s390x: In s390_disasm_aux - simplify control flow a bit. Diff: --- VEX/priv/s390_disasm.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/VEX/priv/s390_disasm.c b/VEX/priv/s390_disasm.c index 139e141990..0b03c14edd 100644 --- a/VEX/priv/s390_disasm.c +++ b/VEX/priv/s390_disasm.c @@ -1093,14 +1093,11 @@ s390_disasm_aux(const s390_opnd *opnds, const HChar *xmnm, HChar *p, vassert(opnds[0].kind == S390_OPND_MNM || opnds[0].kind == S390_OPND_XMNM); - Int separator = 0; + Int write_separator = 0; // no separator after mnemonic for (UInt ix = 0; opnds[ix].kind != S390_OPND_DONE; ++ix) { const s390_opnd *opnd = opnds + ix; - if (ix > 1 && separator) - *p++ = ','; - switch (opnd->kind) { case S390_OPND_MNM: p += vex_sprintf(p, "%s", padmnm(opnd->mnm)); @@ -1132,13 +1129,9 @@ s390_disasm_aux(const s390_opnd *opnds, const HChar *xmnm, HChar *p, UInt value; if (mh && mh(ix, opnd->mask, &value)) p += vex_sprintf(p, "%u", value); - else { - if (ix != 1) - (*--p) = '\0'; // overwrite the separator - else - separator = 0; - } - continue; // *not* break + else + write_separator = 0; + break; } case S390_OPND_UINT: @@ -1204,8 +1197,14 @@ s390_disasm_aux(const s390_opnd *opnds, const HChar *xmnm, HChar *p, break; } - separator = ','; + if (write_separator) + *p++ = ','; + write_separator = 1; } + + if (p[-1] == ',') // remove trailing separator, if any + *--p = '\0'; + return p; } |