RedDrawable really is a RedDrawCmd which is parsed by red-parse-qxl.h This commit moves them close to the other functions creating/unref'ing QXL commands parsed by red-parse-qxl.h --- server/red-parse-qxl.c | 21 +++++++++++++++++++++ server/red-parse-qxl.h | 2 ++ server/red-worker.c | 20 -------------------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c index b766e9935..66e851bb1 100644 --- a/server/red-parse-qxl.c +++ b/server/red-parse-qxl.c @@ -26,6 +26,7 @@ #include "red-common.h" #include "red-qxl.h" #include "memslot.h" +#include "red-qxl.h" #include "red-parse-qxl.h" /* Max size in bytes for any data field used in a QXL command. @@ -1497,3 +1498,23 @@ void red_put_cursor_cmd(RedCursorCmd *red) red_qxl_release_resource(red->qxl, red->release_info_ext); } } + +void red_drawable_unref(RedDrawable *red_drawable) +{ + if (--red_drawable->refs) { + return; + } + red_qxl_release_resource(red_drawable->qxl, red_drawable->release_info_ext); + red_put_drawable(red_drawable); + g_free(red_drawable); +} + +RedDrawable *red_drawable_new(QXLInstance *qxl) +{ + RedDrawable * red = g_new0(RedDrawable, 1); + + red->refs = 1; + red->qxl = qxl; + + return red; +} diff --git a/server/red-parse-qxl.h b/server/red-parse-qxl.h index a33f36adb..0b507b93a 100644 --- a/server/red-parse-qxl.h +++ b/server/red-parse-qxl.h @@ -64,6 +64,8 @@ static inline RedDrawable *red_drawable_ref(RedDrawable *drawable) drawable->refs++; return drawable; } +RedDrawable *red_drawable_new(QXLInstance *qxl); +void red_drawable_unref(RedDrawable *red_drawable); void red_drawable_unref(RedDrawable *red_drawable); diff --git a/server/red-worker.c b/server/red-worker.c index eb927f3e0..8f806e8e3 100644 --- a/server/red-worker.c +++ b/server/red-worker.c @@ -99,16 +99,6 @@ static int display_is_connected(RedWorker *worker) red_channel_is_connected(RED_CHANNEL(worker->display_channel)); } -void red_drawable_unref(RedDrawable *red_drawable) -{ - if (--red_drawable->refs) { - return; - } - red_qxl_release_resource(red_drawable->qxl, red_drawable->release_info_ext); - red_put_drawable(red_drawable); - g_free(red_drawable); -} - static gboolean red_process_cursor_cmd(RedWorker *worker, const QXLCommandExt *ext) { RedCursorCmd *cursor_cmd; @@ -165,16 +155,6 @@ static int red_process_cursor(RedWorker *worker, int *ring_is_empty) return n; } -static RedDrawable *red_drawable_new(QXLInstance *qxl) -{ - RedDrawable * red = g_new0(RedDrawable, 1); - - red->refs = 1; - red->qxl = qxl; - - return red; -} - static gboolean red_process_surface_cmd(RedWorker *worker, QXLCommandExt *ext, gboolean loadvm) { RedSurfaceCmd surface_cmd; -- 2.14.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel