[libvirt] [PATCH 2/2] examples: include config.h

Daniel P. Berrangé berrange at redhat.com
Wed Jan 9 10:24:40 UTC 2019


On Fri, Jan 04, 2019 at 04:22:42PM +0100, Ján Tomko wrote:
> Since gnulib commit 6954995d unistd.h is included via stdlib.h
> on BSD systems, which requires config.h to be included first.
> 
> Add config.h to the files that use it.

This is not desirable.  The examples/ programs are supposed to
be self-contained demos that you can compile outside of libvirt.
They should not require any of the autoconf related stuff lilke
config.h

> 
> Part of this commit reverts commit 6ee918de7462a20947241ec817c4571d6b84a716
> 
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>  examples/admin/client_close.c        | 2 ++
>  examples/admin/client_info.c         | 3 ++-
>  examples/admin/client_limits.c       | 2 ++
>  examples/admin/list_clients.c        | 2 ++
>  examples/admin/list_servers.c        | 2 ++
>  examples/admin/logging.c             | 3 ++-
>  examples/admin/threadpool_params.c   | 2 ++
>  examples/dommigrate/dommigrate.c     | 2 ++
>  examples/hellolibvirt/hellolibvirt.c | 2 ++
>  examples/openauth/openauth.c         | 2 ++
>  examples/rename/rename.c             | 2 ++
>  11 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/admin/client_close.c b/examples/admin/client_close.c
> index 5c28ce7949..9b7e1febb1 100644
> --- a/examples/admin/client_close.c
> +++ b/examples/admin/client_close.c
> @@ -1,3 +1,5 @@
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt.h>
> diff --git a/examples/admin/client_info.c b/examples/admin/client_info.c
> index 2c46ccf514..550a24824a 100644
> --- a/examples/admin/client_info.c
> +++ b/examples/admin/client_info.c
> @@ -1,4 +1,5 @@
> -#define _GNU_SOURCE
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <time.h>
> diff --git a/examples/admin/client_limits.c b/examples/admin/client_limits.c
> index 69b931682c..a87cb52c82 100644
> --- a/examples/admin/client_limits.c
> +++ b/examples/admin/client_limits.c
> @@ -1,3 +1,5 @@
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt-admin.h>
> diff --git a/examples/admin/list_clients.c b/examples/admin/list_clients.c
> index 15205a7bd1..1d961a1ec9 100644
> --- a/examples/admin/list_clients.c
> +++ b/examples/admin/list_clients.c
> @@ -1,3 +1,5 @@
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <time.h>
> diff --git a/examples/admin/list_servers.c b/examples/admin/list_servers.c
> index e53cd3b48f..d48d87af6e 100644
> --- a/examples/admin/list_servers.c
> +++ b/examples/admin/list_servers.c
> @@ -1,3 +1,5 @@
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt-admin.h>
> diff --git a/examples/admin/logging.c b/examples/admin/logging.c
> index dc1b23aab5..10952afa03 100644
> --- a/examples/admin/logging.c
> +++ b/examples/admin/logging.c
> @@ -1,8 +1,9 @@
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <stdbool.h>
>  
> -#include "config.h"
>  #include <unistd.h>
>  #include <libvirt/libvirt-admin.h>
>  #include <libvirt/virterror.h>
> diff --git a/examples/admin/threadpool_params.c b/examples/admin/threadpool_params.c
> index be833c2ea3..9517dcb0f2 100644
> --- a/examples/admin/threadpool_params.c
> +++ b/examples/admin/threadpool_params.c
> @@ -1,3 +1,5 @@
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt-admin.h>
> diff --git a/examples/dommigrate/dommigrate.c b/examples/dommigrate/dommigrate.c
> index 1b6072d138..71a0af4058 100644
> --- a/examples/dommigrate/dommigrate.c
> +++ b/examples/dommigrate/dommigrate.c
> @@ -20,6 +20,8 @@
>   * <http://www.gnu.org/licenses/>.
>   */
>  
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt.h>
> diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c
> index bfb12846e6..02c4401987 100644
> --- a/examples/hellolibvirt/hellolibvirt.c
> +++ b/examples/hellolibvirt/hellolibvirt.c
> @@ -2,6 +2,8 @@
>   * hypervisor and gather a few bits of information about domains.
>   * Similar API's exist for storage pools, networks, and interfaces. */
>  
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt.h>
> diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c
> index efd21c374f..eef46d5f52 100644
> --- a/examples/openauth/openauth.c
> +++ b/examples/openauth/openauth.c
> @@ -1,6 +1,8 @@
>  /* This is a copy of the hellolibvirt example demonstaring how to use
>   * virConnectOpenAuth with a custom auth callback */
>  
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> diff --git a/examples/rename/rename.c b/examples/rename/rename.c
> index 85f18e9df3..c64dd5baa3 100644
> --- a/examples/rename/rename.c
> +++ b/examples/rename/rename.c
> @@ -16,6 +16,8 @@
>   * <http://www.gnu.org/licenses/>.
>   */
>  
> +#include <config.h>
> +
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <libvirt/libvirt.h>
> -- 
> 2.16.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list