Re: [PATCH v2 5/5] Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy

Pedro Alves
2017-01-25T18:27:58Z

On 01/24/2017 06:29 PM, Simon Marchi wrote:
>
>> diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
>> index d06c481..bf3c424 100644
>> --- a/gdb/guile/scm-disasm.c
>> +++ b/gdb/guile/scm-disasm.c
>> @@ -162,7 +162,7 @@ gdbscm_disasm_print_address (bfd_vma addr, struct
>> disassemble_info *info)
>> static int
>> gdbscm_print_insn_from_port (struct gdbarch *gdbarch,
>> SCM port, ULONGEST offset, CORE_ADDR memaddr,
>> - struct ui_file *stream, int *branch_delay_insns)
>> + string_file *stream, int *branch_delay_insns)
>
> Reference instead of pointer? I don't really mind, it's just that
> you've used references in other places (e.g. the compile code) when
> changing a ui_file pointer to a more specific type.

I failed to notice this comment, sorry.

Yeah, I think I had changed most places, but there will
be places I didn't, mainly to avoid growing the patch too
much with not-that-useful churn. Here, we have:

static int
gdbscm_print_insn_from_port (struct gdbarch *gdbarch,
SCM port, ULONGEST offset, CORE_ADDR memaddr,
string_file *stream, int *branch_delay_insns)
{
struct disassemble_info di;
int length;
struct gdbscm_disasm_data data;

di = gdb_disassemble_info (gdbarch, stream);

and the only use of "stream" in the function is passing
the pointer to gdb_disassemble_info, so I left it be.

grepping the diff for "string_file \*", I get:

+ string_file *stream, int *branch_delay_insns)
+string_file *
+ return (string_file *) m_streams.back ();
+ string_file *mi_stream = main_stream ();
+ struct string_file *stream = new string_file ();
+ string_file *main_stream ();

Looks like it may have been the only place.

Thanks,
Pedro Alves