[Spice-devel] [PATCH spice-server 2/2] Use --enable-extra-checks option provided by spice-common

Frediano Ziglio fziglio at redhat.com
Mon Mar 19 13:46:57 UTC 2018


Reuse option from common code.
Also reuse spice_extra_checks constant instead of using the preprocessor
macro directly.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 configure.ac               | 9 +--------
 server/display-channel.c   | 2 +-
 server/red-stream-device.c | 6 +++---
 server/reds.c              | 2 +-
 spice-common               | 2 +-
 5 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/configure.ac b/configure.ac
index 86383434..2443ccf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,7 @@ esac
 dnl =========================================================================
 dnl Check optional features
 SPICE_CHECK_SMARTCARD
+SPICE_EXTRA_CHECKS
 
 AC_ARG_ENABLE(gstreamer,
               AS_HELP_STRING([--enable-gstreamer=@<:@auto/0.10/1.0/yes/no@:>@],
@@ -237,14 +238,6 @@ AC_ARG_ENABLE([statistics],
 AS_IF([test "$enable_statistics" = "yes"],
       [AC_DEFINE([RED_STATISTICS], [1], [Enable SPICE statistics])])
 
-AC_ARG_ENABLE([extra-checks],
-               AS_HELP_STRING([--enable-extra-checks=@<:@yes/no@:>@],
-                              [Enable expensive checks @<:@default=no@:>@]))
-AM_CONDITIONAL(ENABLE_EXTRA_CHECKS, test "$enable_extra_checks" = "yes")
-AC_DEFINE_UNQUOTED([ENABLE_EXTRA_CHECKS],
-                   [$(test "x$enable_extra_checks" = xyes && echo 1 || echo 0)],
-                   [Define to 1 to enable extra checks on code otherwise define to 0])
-
 dnl ===========================================================================
 dnl check compiler flags
 
diff --git a/server/display-channel.c b/server/display-channel.c
index 6dc10ee7..229f2c0f 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -89,7 +89,7 @@ display_channel_finalize(GObject *object)
     display_channel_destroy_surfaces(self);
     image_cache_reset(&self->priv->image_cache);
 
-    if (ENABLE_EXTRA_CHECKS) {
+    if (spice_extra_checks) {
         unsigned int count;
         _Drawable *drawable;
         VideoStream *stream;
diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index c87c4899..e91df88d 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -195,7 +195,7 @@ handle_msg_invalid(StreamDevice *dev, SpiceCharDeviceInstance *sin, const char *
 {
     static const char default_error_msg[] = "Protocol error";
 
-    if (ENABLE_EXTRA_CHECKS) {
+    if (spice_extra_checks) {
         spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
     }
 
@@ -232,7 +232,7 @@ handle_msg_format(StreamDevice *dev, SpiceCharDeviceInstance *sin)
 {
     SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
 
-    if (ENABLE_EXTRA_CHECKS) {
+    if (spice_extra_checks) {
         spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
         spice_assert(dev->hdr.type == STREAM_TYPE_FORMAT);
     }
@@ -260,7 +260,7 @@ handle_msg_data(StreamDevice *dev, SpiceCharDeviceInstance *sin)
     SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
     int n;
 
-    if (ENABLE_EXTRA_CHECKS) {
+    if (spice_extra_checks) {
         spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
         spice_assert(dev->hdr.type == STREAM_TYPE_DATA);
     }
diff --git a/server/reds.c b/server/reds.c
index 752bf7c2..998f2ffa 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -4442,7 +4442,7 @@ red_char_device_vdi_port_finalize(GObject *object)
         dev->priv->current_read_buf = NULL;
     }
     g_free(dev->priv->mig_data);
-    if (ENABLE_EXTRA_CHECKS) {
+    if (spice_extra_checks) {
         spice_assert(dev->priv->num_read_buf == 0);
     }
 
diff --git a/spice-common b/spice-common
index 8096b120..cc4a7f5c 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 8096b1206bb266b8d0b80b3e4c0d36fc621d772d
+Subproject commit cc4a7f5c7535fd5ed6756549bb918f1a54e9ea11
-- 
2.14.3



More information about the Spice-devel mailing list