[Spice-devel] [PATCH] char-device.h: add needed headers

Frediano Ziglio fziglio at redhat.com
Wed Jun 1 15:20:00 UTC 2016


> 
> Include spice-common headers for types that are used directly in the
> RedCharDevice header.
> ---
> These includes are not currently needed -- they get pulled in by the
> red-channel.h include. But if we decide in the future to remove the
> red-channel.h include here and use forward declarations (e.g. to reduce
> compile
> time), the build would break.
> 
> It's generally my opinion that headers for types that are used in a file
> should
> be explicitly included rather than relying on indirect inclusion via other
> headers. But since this patch doesn't currently fix any problems, it could be
> rejected with no ill effects.
> 

I think this patch got a bit buried by other ones.

I think would like to be good to have some rule about these stuff.

The common/ring.h is needed as some structure are using RingItem however
in refactory branch this field is removed.
About common/marshaller.h we use it only for a pointer so if we decide
to go with pre declaration and avoid having to include the definition
we won't have to include this header.

Frediano

>  server/char-device.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/server/char-device.h b/server/char-device.h
> index 39bff4e..2a2fc94 100644
> --- a/server/char-device.h
> +++ b/server/char-device.h
> @@ -19,6 +19,8 @@
>  #define CHAR_DEVICE_H_
>  
>  #include <glib-object.h>
> +#include <common/ring.h>
> +#include <common/marshaller.h>
>  
>  #include "spice.h"
>  #include "red-channel.h"


More information about the Spice-devel mailing list