[PATCH] nscd: Deallocate existing user names in file parser

DJ Delorie dj@redhat.com
Mon Aug 13 21:19:00 GMT 2018


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.



More information about the Libc-alpha mailing list