aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-06-13 09:52:59 +0200
committerJan Beulich <jbeulich@suse.com>2022-06-13 09:52:59 +0200
commit32f06c69f2284bc925e8d56fecbfc2a3f9f7301f (patch)
tree292328164108cbb5bd1427042dcc86dcf98d3c7e /opcodes
parenteebc56d682ddc8da6c9caa50bee4225926e3accd (diff)
downloadgdb-32f06c69f2284bc925e8d56fecbfc2a3f9f7301f.zip
gdb-32f06c69f2284bc925e8d56fecbfc2a3f9f7301f.tar.gz
gdb-32f06c69f2284bc925e8d56fecbfc2a3f9f7301f.tar.bz2
x86: avoid string copy when swapping Vex.W controlled operands
Now that op_out[] is an array of pointers, there's no need anymore to copy strings. Simply swap the pointers.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/i386-dis.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 602535d..d087b35 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -13473,9 +13473,10 @@ OP_VexW (instr_info *ins, int bytemode, int sizeflag)
if (ins->vex.w)
{
/* Swap 2nd and 3rd operands. */
- strcpy (ins->scratchbuf, ins->op_out[2]);
- strcpy (ins->op_out[2], ins->op_out[1]);
- strcpy (ins->op_out[1], ins->scratchbuf);
+ char *tmp = ins->op_out[2];
+
+ ins->op_out[2] = ins->op_out[1];
+ ins->op_out[1] = tmp;
}
}
@@ -13503,9 +13504,10 @@ OP_REG_VexI4 (instr_info *ins, int bytemode, int sizeflag ATTRIBUTE_UNUSED)
if (ins->vex.w)
{
/* Swap 3rd and 4th operands. */
- strcpy (ins->scratchbuf, ins->op_out[3]);
- strcpy (ins->op_out[3], ins->op_out[2]);
- strcpy (ins->op_out[2], ins->scratchbuf);
+ char *tmp = ins->op_out[3];
+
+ ins->op_out[3] = ins->op_out[2];
+ ins->op_out[2] = tmp;
}
}