[libvirt] RFC: fixing struct name in public header

Martin Kletzander mkletzan at redhat.com
Wed Apr 12 13:07:18 UTC 2017


On Wed, Apr 12, 2017 at 12:31:51PM +0100, Daniel P. Berrange wrote:
>Take a look at this def from libvirt-domain.h:
>
>typedef struct _virDomainInterfaceIPAddress virDomainIPAddress;
>typedef virDomainIPAddress *virDomainIPAddressPtr;
>struct _virDomainInterfaceIPAddress {
>    int type;                /* virIPAddrType */
>    char *addr;              /* IP address */
>    unsigned int prefix;     /* IP address prefix */
>};
>
>
>Notice the struct name is different from the typedef names.
>
>Technically renaming the struct to remove the 'Interface' word
>would be an API break.
>
>On the flip side though we don't expect any apps to use the struct
>name, but rather use the typedefs, hence use of '_' in the name.
>

Yeah, also if you look at the documentation [1], we use the typedef name
even for the struct name (strictly technically wrong).  The
_virDomainInterfaceIPAddress is used in one place there and hence, in my
opinion, it is not a breakage if we *just* rename it.

[1] http://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIPAddress

>We could do what we did with the typed parameter stuff and rename
>the struct, but add a
>
>  #define _virDomainInterfaceIPAddress _virDomainIPAddress
>
>Any thoughts ?
>
>Regards,
>Daniel
>--
>|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
>|: http://libvirt.org              -o-             http://virt-manager.org :|
>|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170412/0af2cf7a/attachment-0001.sig>


More information about the libvir-list mailing list