[Spice-devel] [PATCH 4/9] server/red_worker: simplify monitors_config update
Alon Levy
alevy at redhat.com
Fri May 17 08:08:09 PDT 2013
---
server/red_worker.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/server/red_worker.c b/server/red_worker.c
index 14d219b..f047d29 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1279,6 +1279,9 @@ static MonitorsConfig *monitors_config_getref(MonitorsConfig *monitors_config)
static void monitors_config_decref(MonitorsConfig *monitors_config)
{
+ if (!monitors_config) {
+ return;
+ }
if (--monitors_config->refs > 0) {
return;
}
@@ -11339,9 +11342,7 @@ static void worker_update_monitors_config(RedWorker *worker,
MonitorsConfig *monitors_config;
int i;
- if (worker->monitors_config) {
- monitors_config_decref(worker->monitors_config);
- }
+ monitors_config_decref(worker->monitors_config);
spice_debug("monitors config %d(%d)",
dev_monitors_config->count,
@@ -11396,12 +11397,10 @@ static void set_monitors_config_to_primary(RedWorker *worker)
DrawContext *context;
if (!worker->surfaces[0].context.canvas) {
- spice_warning("%s: no primary surface", __FUNCTION__);
+ spice_warning("no primary surface");
return;
}
- if (worker->monitors_config) {
- monitors_config_decref(worker->monitors_config);
- }
+ monitors_config_decref(worker->monitors_config);
context = &worker->surfaces[0].context;
worker->monitors_config =
spice_malloc(sizeof(*worker->monitors_config) + sizeof(QXLHead));
--
1.8.2.1
More information about the Spice-devel
mailing list