Message ID | 20220815072629.12865-18-milica.lazarevic@syrmia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Convert nanoMIPS disassembler from C++ to C | expand |
On 15/08/2022 09.26, Milica Lazarevic wrote: > Replaced argument passing by reference with passing by address. > > Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com> > --- > disas/nanomips.cpp | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp > index 9406805367..7dfefdc5ed 100644 > --- a/disas/nanomips.cpp > +++ b/disas/nanomips.cpp > @@ -638,7 +638,7 @@ static uint64 extract_op_code_value(const uint16 *data, int size) > * disassembly string - on error will constain error string > */ > static int Disassemble(const uint16 *data, char *dis, > - TABLE_ENTRY_TYPE & type, const Pool *table, > + TABLE_ENTRY_TYPE *type, const Pool *table, > int table_size) > { > for (int i = 0; i < table_size; i++) { > @@ -673,7 +673,7 @@ static int Disassemble(const uint16 *data, char *dis, > "disassembler failure - bad table entry"); > return -6; > } > - type = table[i].type; > + *type = table[i].type; > const char *dis_str = dis_fn(op_code); > strcpy(dis, dis_str); > free((char *)dis_str); > @@ -22792,7 +22792,7 @@ int nanomips_dis(char *buf, > TABLE_ENTRY_TYPE type; > m_pc = address; > m_requested_instruction_categories = ALL_ATTRIBUTES; > - int size = Disassemble(bits, disasm, type, MAJOR, 2); > + int size = Disassemble(bits, disasm, &type, MAJOR, 2); > > strcpy(buf, disasm); > return size; Reviewed-by: Thomas Huth <thuth@redhat.com>
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index 9406805367..7dfefdc5ed 100644 --- a/disas/nanomips.cpp +++ b/disas/nanomips.cpp @@ -638,7 +638,7 @@ static uint64 extract_op_code_value(const uint16 *data, int size) * disassembly string - on error will constain error string */ static int Disassemble(const uint16 *data, char *dis, - TABLE_ENTRY_TYPE & type, const Pool *table, + TABLE_ENTRY_TYPE *type, const Pool *table, int table_size) { for (int i = 0; i < table_size; i++) { @@ -673,7 +673,7 @@ static int Disassemble(const uint16 *data, char *dis, "disassembler failure - bad table entry"); return -6; } - type = table[i].type; + *type = table[i].type; const char *dis_str = dis_fn(op_code); strcpy(dis, dis_str); free((char *)dis_str); @@ -22792,7 +22792,7 @@ int nanomips_dis(char *buf, TABLE_ENTRY_TYPE type; m_pc = address; m_requested_instruction_categories = ALL_ATTRIBUTES; - int size = Disassemble(bits, disasm, type, MAJOR, 2); + int size = Disassemble(bits, disasm, &type, MAJOR, 2); strcpy(buf, disasm); return size;
Replaced argument passing by reference with passing by address. Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com> --- disas/nanomips.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)