[RFA 2/8] Use class to manage BFD reference counts

Tom Tromey tom@tromey.com
Tue Dec 13 13:26:00 GMT 2016


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> -    return NULL;
>> +    return gdb_bfd_ref_ptr ();

Pedro> This provides a good reason to have an implicit construction from
Pedro> nullptr_t.  You had it in the original gdbpy_reference
Pedro> submission, but I had asked to remove it.  If we add it back,
Pedro> these cases could be more clearly written as "return
Pedro> NULL/nullptr".  Could you do that, and then drop all the hunks
Pedro> like:

>> -    return NULL;
>> +    return gdb_bfd_ref_ptr ();

Pedro> ?

I did this.

Pedro> I think these could be:
Pedro>     std::string filename
Pedro>       = string_printf ("%.*s", filename_len, pathname);
Pedro>     std::string member_name
Pedro>       = string_printf ("%.*s", path_len - filename_len - 2, sep + 1));

I did this, but it's a bit ugly as solib_find isn't const-correct.

I'll send a new patch soon.

Tom



More information about the Gdb-patches mailing list