[Spice-devel] [spice 2/3] server: Use SPICE_GNUC_DEPRECATED to avoid a dependency on glib.h

Frediano Ziglio fziglio at redhat.com
Fri Aug 12 07:26:02 UTC 2016


> 
> spice-server.h cannot include glib.h because it is a public header and
> is used by projects that do not use GLib.
> 
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
>  server/spice-migration.h |  4 ++--
>  server/spice-server.h    | 13 ++++++-------
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/server/spice-migration.h b/server/spice-migration.h
> index 9528f0e..58b1cbb 100644
> --- a/server/spice-migration.h
> +++ b/server/spice-migration.h
> @@ -46,8 +46,8 @@ struct SpiceMigrateInstance {
>  /* spice switch-host client migration */
>  int spice_server_migrate_info(SpiceServer *s, const char* dest,
>                                int port, int secure_port,
> -                              const char* cert_subject) G_GNUC_DEPRECATED;
> -int spice_server_migrate_switch(SpiceServer *s) G_GNUC_DEPRECATED;
> +                              const char* cert_subject)
> SPICE_GNUC_DEPRECATED;
> +int spice_server_migrate_switch(SpiceServer *s) SPICE_GNUC_DEPRECATED;
>  
>  /* spice (semi-)seamless client migration */
>  int spice_server_migrate_connect(SpiceServer *s, const char* dest,
> diff --git a/server/spice-server.h b/server/spice-server.h
> index 6eb1b1d..4d1703b 100644
> --- a/server/spice-server.h
> +++ b/server/spice-server.h
> @@ -22,8 +22,7 @@
>  #error "Only spice.h can be included directly."
>  #endif
>  
> -#include <glib.h>
> -
> +#include <spice/macros.h>
>  #include "spice-core.h"

spice-core.h already include <spice/macros.h> so I would
avoid to add the include here (as the other headers).

>  
>  /* Don't use features incompatible with a specific spice
> @@ -50,7 +49,7 @@ int spice_server_set_compat_version(SpiceServer *s,
>                                      spice_compat_version_t version);
>  int spice_server_set_port(SpiceServer *s, int port);
>  void spice_server_set_addr(SpiceServer *s, const char *addr, int flags);
> -int spice_server_set_listen_socket_fd(SpiceServer *s, int listen_fd)
> G_GNUC_DEPRECATED;
> +int spice_server_set_listen_socket_fd(SpiceServer *s, int listen_fd)
> SPICE_GNUC_DEPRECATED;
>  int spice_server_set_exit_on_disconnect(SpiceServer *s, int flag);
>  int spice_server_set_noauth(SpiceServer *s);
>  int spice_server_set_sasl(SpiceServer *s, int enabled);
> @@ -104,7 +103,7 @@ int spice_server_set_zlib_glz_compression(SpiceServer *s,
> spice_wan_compression_
>  
>  int spice_server_set_channel_security(SpiceServer *s, const char *channel,
>  int security);
>  
> -int spice_server_add_renderer(SpiceServer *s, const char *name)
> G_GNUC_DEPRECATED;
> +int spice_server_add_renderer(SpiceServer *s, const char *name)
> SPICE_GNUC_DEPRECATED;
>  
>  enum {
>      SPICE_STREAM_VIDEO_INVALID,
> @@ -127,8 +126,8 @@ int spice_server_set_agent_mouse(SpiceServer *s, int
> enable);
>  int spice_server_set_agent_copypaste(SpiceServer *s, int enable);
>  int spice_server_set_agent_file_xfer(SpiceServer *s, int enable);
>  
> -int spice_server_get_sock_info(SpiceServer *s, struct sockaddr *sa,
> socklen_t *salen) G_GNUC_DEPRECATED;
> -int spice_server_get_peer_info(SpiceServer *s, struct sockaddr *sa,
> socklen_t *salen) G_GNUC_DEPRECATED;
> +int spice_server_get_sock_info(SpiceServer *s, struct sockaddr *sa,
> socklen_t *salen) SPICE_GNUC_DEPRECATED;
> +int spice_server_get_peer_info(SpiceServer *s, struct sockaddr *sa,
> socklen_t *salen) SPICE_GNUC_DEPRECATED;
>  
>  int spice_server_is_server_mouse(SpiceServer *s);
>  
> @@ -138,6 +137,6 @@ void spice_server_set_uuid(SpiceServer *s, const uint8_t
> uuid[16]);
>  void spice_server_vm_start(SpiceServer *s);
>  void spice_server_vm_stop(SpiceServer *s);
>  
> -int spice_server_get_num_clients(SpiceServer *s) G_GNUC_DEPRECATED;
> +int spice_server_get_num_clients(SpiceServer *s) SPICE_GNUC_DEPRECATED;
>  
>  #endif /* SPICE_SERVER_H_ */

Beside the include the patch is fine, if you agree I can change and
merge.

Frediano


More information about the Spice-devel mailing list