[Spice-devel] [PATCH] Remove use of spice_warn_if()
Christophe Fergeau
cfergeau at redhat.com
Mon Nov 30 04:04:26 PST 2015
spice_warn_if_fail() is doing the same thing except for the inverted
condition. spice_warn_if() is being removed from spice-common to avoid
having potentially confusing redundancy.
---
server/display-channel.c | 7 ++++---
server/red_worker.c | 10 +++++-----
server/snd_worker.c | 2 +-
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/server/display-channel.c b/server/display-channel.c
index 580025f..16d9dc6 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -284,7 +284,7 @@ void display_channel_surface_unref(DisplayChannel *display, uint32_t surface_id)
dcc_destroy_surface(dcc, surface_id);
}
- spice_warn_if(!ring_is_empty(&surface->depend_on_me));
+ spice_warn_if_fail(ring_is_empty(&surface->depend_on_me));
}
/* TODO: perhaps rename to "ready" or "realized" ? */
@@ -339,7 +339,8 @@ static void pipes_add_drawable(DisplayChannel *display, Drawable *drawable)
DisplayChannelClient *dcc;
RingItem *dcc_ring_item, *next;
- spice_warn_if(!ring_is_empty(&drawable->pipes));
+ spice_warn_if_fail(ring_is_empty(&drawable->pipes));
+
FOREACH_DCC(display, dcc_ring_item, next, dcc) {
dcc_prepend_drawable(dcc, drawable);
}
@@ -1627,7 +1628,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
{
RedSurface *surface = &display->surfaces[surface_id];
- spice_warn_if(surface->context.canvas);
+ spice_warn_if_fail(!surface->context.canvas);
surface->context.canvas_draws_on_surface = FALSE;
surface->context.width = width;
diff --git a/server/red_worker.c b/server/red_worker.c
index ebb2bba..fb9ad7c 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1182,9 +1182,9 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
int error;
spice_debug(NULL);
- spice_warn_if(surface_id != 0);
- spice_warn_if(surface.height == 0);
- spice_warn_if(((uint64_t)abs(surface.stride) * (uint64_t)surface.height) !=
+ spice_warn_if_fail(surface_id == 0);
+ spice_warn_if_fail(surface.height != 0);
+ spice_warn_if_fail(((uint64_t)abs(surface.stride) * (uint64_t)surface.height) ==
abs(surface.stride) * surface.height);
line_0 = (uint8_t*)get_virt(&worker->mem_slots, surface.mem,
@@ -1234,7 +1234,7 @@ static void destroy_primary_surface(RedWorker *worker, uint32_t surface_id)
if (!validate_surface(display, surface_id))
return;
- spice_warn_if(surface_id != 0);
+ spice_warn_if_fail(surface_id == 0);
spice_debug(NULL);
if (!display->surfaces[surface_id].context.canvas) {
@@ -1932,7 +1932,7 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
init_info.memslot_id_bits,
init_info.internal_groupslot_id);
- spice_warn_if(init_info.n_surfaces > NUM_SURFACES);
+ spice_warn_if_fail(init_info.n_surfaces <= NUM_SURFACES);
worker->event_timeout = INF_EVENT_WAIT;
diff --git a/server/snd_worker.c b/server/snd_worker.c
index b039939..dbd50d1 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -421,7 +421,7 @@ static void snd_receive(void* data)
for (;;) {
ssize_t n;
n = channel->receive_data.end - channel->receive_data.now;
- spice_warn_if(n <= 0);
+ spice_warn_if_fail(n > 0);
n = reds_stream_read(channel->stream, channel->receive_data.now, n);
if (n <= 0) {
if (n == 0) {
--
2.5.0
More information about the Spice-devel
mailing list