Re: [RFA 15/22] Use std::string in macho_symfile_read_all_oso

Pedro Alves
2016-10-09T17:28:03Z

On 09/27/2016 05:08 AM, Tom Tromey wrote:
>
> - memcpy (archive_name, oso->name, pfx_len);
> - archive_name[pfx_len] = '\0';
> -
> - make_cleanup (xfree, archive_name);
> + std::string archive_name (oso->name, pfx_len);
>
> /* Compute number of oso for this archive. */
> for (last_ix = ix;
> VEC_iterate (oso_el, vec, last_ix, oso2); last_ix++)
> {
> - if (strncmp (oso2->name, archive_name, pfx_len) != 0)
> + if (strncmp (oso2->name, archive_name.c_str (), pfx_len) != 0)

> + if (strncmp (oso2->name, archive_name.c_str (), pfx_len) != 0)

Since archive_name is now a std::string, we can use ==/!= for string
comparison:

if (archive_name != oso2->name)

Otherwise LGTM, and can go in immediately.

Thanks,
Pedro Alves