Use --enable-extra-checks option provided by spice-common

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

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
This commit is contained in:
Frediano Ziglio 2018-03-19 13:45:02 +00:00
parent f1b2d09b00
commit 48fd9b0898
5 changed files with 7 additions and 14 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

@ -1 +1 @@
Subproject commit 8096b1206bb266b8d0b80b3e4c0d36fc621d772d
Subproject commit 4c2d0e977272c5540634d24f485dd64c424f6748