Change virConnectDomainEventGraphicsCallback signature

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.

Although this is an API change (not ABI though), 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.
This commit is contained in:
Michal Privoznik 2013-05-19 12:48:11 +02:00
parent 1f5deed9b6
commit 6ac6f59c98

View File

@ -4504,8 +4504,8 @@ typedef enum {
*/ */
struct _virDomainEventGraphicsAddress { struct _virDomainEventGraphicsAddress {
int family; /* Address family, virDomainEventGraphicsAddressType */ int family; /* Address family, virDomainEventGraphicsAddressType */
const char *node; /* Address of node (eg IP address, or UNIX path) */ char *node; /* Address of node (eg IP address, or UNIX path) */
const char *service; /* Service name/number (eg TCP port, or NULL) */ char *service; /* Service name/number (eg TCP port, or NULL) */
}; };
typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress; typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress;
typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr; typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr;
@ -4520,8 +4520,8 @@ typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr;
* some examples are 'x509dname' and 'saslUsername'. * some examples are 'x509dname' and 'saslUsername'.
*/ */
struct _virDomainEventGraphicsSubjectIdentity { struct _virDomainEventGraphicsSubjectIdentity {
const char *type; /* Type of identity */ char *type; /* Type of identity */
const char *name; /* Identity value */ char *name; /* Identity value */
}; };
typedef struct _virDomainEventGraphicsSubjectIdentity virDomainEventGraphicsSubjectIdentity; typedef struct _virDomainEventGraphicsSubjectIdentity virDomainEventGraphicsSubjectIdentity;
typedef virDomainEventGraphicsSubjectIdentity *virDomainEventGraphicsSubjectIdentityPtr; typedef virDomainEventGraphicsSubjectIdentity *virDomainEventGraphicsSubjectIdentityPtr;
@ -4560,10 +4560,10 @@ typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr;
typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn, typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn,
virDomainPtr dom, virDomainPtr dom,
int phase, int phase,
virDomainEventGraphicsAddressPtr local, const virDomainEventGraphicsAddressPtr local,
virDomainEventGraphicsAddressPtr remote, const virDomainEventGraphicsAddressPtr remote,
const char *authScheme, const char *authScheme,
virDomainEventGraphicsSubjectPtr subject, const virDomainEventGraphicsSubjectPtr subject,
void *opaque); void *opaque);
/** /**