[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v4 03/13] Change virConnectDomainEventGraphicsCallback signature



On 05/20/2013 11:55 AM, Michal Privoznik wrote:
> For future work we need _virDomainEventGraphicsAddress and
> _virDomainEventGraphicsSubjectIdentity members to be char * not
> const char *. We are strdup()ing them anyway, so they should have
> been char * anyway (from const correctness POV). However, we
> don't want users to change passed values, so we need to make the
> callback's argument const.
> ---
>  include/libvirt/libvirt.h.in | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Please update your commit message to include a bit more justification -
this part of my analysis on v3 (slightly reworded here) would be a good
start:


Although this is an API change, real callers won't be impacted.  Why?
 1. these callback members are read-only, so it is less likely that
someone is trying to assign into the struct members.
 2. The only way to register a virConnectDomainEventGraphicsCallback is
to cast it through a call to virConnectDomainEventRegisterAny.  That is,
even if the user's callback function leaves out the const, we never use
the typedef as the direct type of any API parameter.  Since they are
already casting their function pointer into a munged type before
registering it, their code will continue to compile.


ACK with that improvement.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]