
On 07/15/2014 02:44 AM, Michal Privoznik wrote:
I take the 'const' as a sign of the fact that I won't be modifying any part of the string. Just adding 'const' to a pointer should be perfectly OK, but I have not objections to your idea, so I squashed this in:
Well, I look at free()-ing as modification of the pointee. Therefore freeing a const pointer is in fact its modification and hence should be rejected.
I agree.
It's just that our VIR_FREE throws away the const-ness of passed pointers. Maybe (as completely separate patchset) we may fix the VIR_FREE() macro which is obviously const-incorrect.
That's due to the number of legacy callers that were already const-incorrect at the time I beefed up VIR_FREE months ago to be more type-safe. But now that the tree is a lot cleaner, I'm in favor of such a cleanup (I see you already started it, but I had more comments in that thread, and now I'm on the hook to provide a v2...). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org