[libvirt] [PATCH 03/10] cleanup: Don't include libvirt/libvirt.h

Eric Blake eblake at redhat.com
Wed Apr 17 03:20:41 UTC 2013


On 04/16/2013 07:41 AM, Osier Yang wrote:
> Which is already included by "internal.h", later patch will add
> syntax-check to avoid it.
> ---

> +++ b/src/nodeinfo.h
> @@ -24,7 +24,6 @@
>  #ifndef __VIR_NODEINFO_H__
>  # define __VIR_NODEINFO_H__
>  
> -# include "libvirt/libvirt.h"
>  # include "capabilities.h"

I took a second look at this after 4/10; thankfully, here you are still
self-contained, via indirection, since capabilities.h includes internal.h.

>  
>  int nodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo);
> diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
> index 3057345..d6d9b0c 100644
> --- a/src/phyp/phyp_driver.c
> +++ b/src/phyp/phyp_driver.c
> @@ -49,7 +49,6 @@
>  #include "viralloc.h"
>  #include "virlog.h"
>  #include "driver.h"
> -#include "libvirt/libvirt.h"

This is clean (internal.h is several lines earlier)

>  #include "virerror.h"
>  #include "viruuid.h"
>  #include "domain_conf.h"
> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index b957b8e..d384225 100644
> --- a/src/remote/remote_protocol.x
> +++ b/src/remote/remote_protocol.x
> @@ -36,7 +36,6 @@
>   * 'REMOTE_'.  This makes names quite long.
>   */
>  
> -%#include <libvirt/libvirt.h>
>  %#include "internal.h"

This is clean.

>  %#include <arpa/inet.h>
>  
> diff --git a/src/util/virkeycode.h b/src/util/virkeycode.h
> index a2e1391..6947cfe 100644
> --- a/src/util/virkeycode.h
> +++ b/src/util/virkeycode.h
> @@ -23,7 +23,6 @@
>  # define __VIR_UTIL_VIRTKEYCODE_H__
>  
>  # include "virutil.h"
> -# include "libvirt/libvirt.h"

This relies on indirect inclusion via virutil.h.  We've used indirect
inclusion before (in fact, internal.h lets us indirectly include common
headers like <errno.h> instead of repeating it everywhere), so that's
fine (I know some other projects like all .h files to be self-contained
without indirect inclusion, but that's a style choice; I'm not proposing
that libvirt adopt it).

So my ACK still stands.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130416/d1b4f144/attachment-0001.sig>


More information about the libvir-list mailing list