This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nscd: Deallocate existing user names in file parser
- From: DJ Delorie <dj at redhat dot com>
- To: Florian Weimer <fw at deneb dot enyo dot de>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 13 Aug 2018 17:19:28 -0400
- Subject: Re: [PATCH] nscd: Deallocate existing user names in file parser
Florian Weimer <fw@deneb.enyo.de> writes:
>> 1. A suitable comment would have make it clearer :-)
>
> I thought this was a standard pattern. 8-)
Well, like I said, I don't feel strongly about it. It looked weird;
I've never had to cast a pointer I'd passed to free() before, and in C++
you cast when you need to match types, so it looked like you were
casting to char* to match what free() expected.
>> 2. Why are those variables const in the first place? They're only ever
>> assigned values from xstrdup(), which isn't const.
>
> Presumably to make clear that no in-place modification is expected. I
> could drop the const from the pointers, then the cast won't be needed
> anymore.
I don't think it's worth the effort, it just seemed weird.