This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libcpp] maybe canonicalize system paths in line-map
Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> a Ãcrit:
> Why not remove this comment and free file here with XDELETEVEC (file) ?
>
>> + Âcanonical_path = maybe_shorter_path (path);
>> + Âif (canonical_path != NULL && canonical_path != path)
>> + Â Â{
>> + Â Â Â/* The canonical path was newly allocated. ÂLet's free the
>> + Â Â Â Ânon-canonical one. Â*/
>> + Â Â Âfree (path);
>> + Â Â Âpath = canonical_path;
>> + Â Â}
>> +
>
> This way you avoid doing all this extra work here.
If I follow my personal style, I'd prefer not having a function delete
what it receives in argument, unless the name of that function makes it
really obvious. Furthermore, that function could be later re-used on a
string that is not necessarily meant to be deleted.
That being said, I don't feel like arguing strongly about this because
ultimately I think this is a matter of style.
I'll let those who have the powers to decide. :-)
--
Dodji