[Spice-commits] server/char-device.c server/reds.c server/red-stream-device.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Mar 3 07:20:11 UTC 2020
server/char-device.c | 2 +-
server/red-stream-device.c | 28 +++++++++-------------------
server/reds.c | 4 +---
3 files changed, 11 insertions(+), 23 deletions(-)
New commits:
commit 0f1a606d304125cbae9dc6692d33c3dc28cf5a3b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Mon Mar 2 15:39:58 2020 +0000
Reuse new spice_extra_assert macro
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/server/char-device.c b/server/char-device.c
index 7d267c60..c1fdfaa5 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -537,7 +537,7 @@ red_char_device_write_buffer_get(RedCharDevice *dev, RedCharDeviceClientOpaque *
if (ret) {
dev->priv->cur_pool_size -= ret->buf_size;
if (ret->buf_size < size) {
- spice_assert(!spice_extra_checks || ret->priv->refs == 1);
+ spice_extra_assert(ret->priv->refs == 1);
red_char_device_write_buffer_free(ret);
ret = NULL;
}
diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index 53d89210..28aab93a 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -224,9 +224,7 @@ handle_msg_invalid(StreamDevice *dev, SpiceCharDeviceInstance *sin, const char *
{
static const char default_error_msg[] = "Protocol error";
- if (spice_extra_checks) {
- spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
- }
+ spice_extra_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
if (!error_msg) {
error_msg = default_error_msg;
@@ -260,10 +258,8 @@ handle_msg_format(StreamDevice *dev, SpiceCharDeviceInstance *sin)
{
SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
- if (spice_extra_checks) {
- spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
- spice_assert(dev->hdr.type == STREAM_TYPE_FORMAT);
- }
+ spice_extra_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
+ spice_extra_assert(dev->hdr.type == STREAM_TYPE_FORMAT);
int n = sif->read(sin, dev->msg->buf + dev->msg_pos, sizeof(StreamMsgFormat) - dev->msg_pos);
if (n < 0) {
@@ -287,10 +283,8 @@ handle_msg_device_display_info(StreamDevice *dev, SpiceCharDeviceInstance *sin)
{
SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
- if (spice_extra_checks) {
- spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
- spice_assert(dev->hdr.type == STREAM_TYPE_DEVICE_DISPLAY_INFO);
- }
+ spice_extra_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
+ spice_extra_assert(dev->hdr.type == STREAM_TYPE_DEVICE_DISPLAY_INFO);
if (dev->msg_len < dev->hdr.size) {
dev->msg = g_realloc(dev->msg, dev->hdr.size);
@@ -354,10 +348,8 @@ handle_msg_capabilities(StreamDevice *dev, SpiceCharDeviceInstance *sin)
{
SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
- if (spice_extra_checks) {
- spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
- spice_assert(dev->hdr.type == STREAM_TYPE_CAPABILITIES);
- }
+ spice_extra_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
+ spice_extra_assert(dev->hdr.type == STREAM_TYPE_CAPABILITIES);
if (dev->hdr.size > STREAM_MSG_CAPABILITIES_MAX_BYTES) {
return handle_msg_invalid(dev, sin, "Wrong size for StreamMsgCapabilities");
@@ -388,10 +380,8 @@ handle_msg_data(StreamDevice *dev, SpiceCharDeviceInstance *sin)
SpiceCharDeviceInterface *sif = spice_char_device_get_interface(sin);
int n;
- if (spice_extra_checks) {
- spice_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
- spice_assert(dev->hdr.type == STREAM_TYPE_DATA);
- }
+ spice_extra_assert(dev->hdr_pos >= sizeof(StreamDevHeader));
+ spice_extra_assert(dev->hdr.type == STREAM_TYPE_DATA);
/* make sure we have a large enough buffer for the whole frame */
/* ---
diff --git a/server/reds.c b/server/reds.c
index face3242..df1fb469 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -4606,9 +4606,7 @@ red_char_device_vdi_port_finalize(GObject *object)
dev->priv->current_read_buf = NULL;
}
g_free(dev->priv->mig_data);
- if (spice_extra_checks) {
- spice_assert(dev->priv->num_read_buf == 0);
- }
+ spice_extra_assert(dev->priv->num_read_buf == 0);
G_OBJECT_CLASS(red_char_device_vdi_port_parent_class)->finalize(object);
}
More information about the Spice-commits
mailing list