Re: RFC: fixing struct name in public header

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

 



On 04/12/2017 01:31 PM, 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.

We could do what we did with the typed parameter stuff and rename
the struct, but add a

  #define _virDomainInterfaceIPAddress _virDomainIPAddress

Any thoughts ?

I'd rename it even without the additional #define. APPs should favour the type instead of using struct _virBlah. We have it there because there's no other way to expose the struct members to callers in C.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux