[Spice-devel] [PATCH 07/15] worker: make more functions static, kill dead function

Pavel Grunt pgrunt at redhat.com
Mon Nov 9 05:50:45 PST 2015


Looks good, but I would split it to:
worker: make more functions static
worker: remove unused function

Pavel

On Mon, 2015-11-09 at 13:16 +0000, Frediano Ziglio wrote:
> From: Marc-André Lureau <marcandre.lureau at gmail.com>
> 
> ---
>  server/red_worker.c | 71 ++++++++++++++++++++++++--------------------------
> ---
>  1 file changed, 32 insertions(+), 39 deletions(-)
> 
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 8f6ef95..0c1a1b1 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -8668,7 +8668,7 @@ void display_channel_update(DisplayChannel *display,
>          region_clear(&surface->draw_dirty_region);
>  }
>  
> -void handle_dev_update_async(void *opaque, void *payload)
> +static void handle_dev_update_async(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>      RedWorkerMessageUpdateAsync *msg = payload;
> @@ -8688,7 +8688,7 @@ void handle_dev_update_async(void *opaque, void
> *payload)
>      free(qxl_dirty_rects);
>  }
>  
> -void handle_dev_update(void *opaque, void *payload)
> +static void handle_dev_update(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>      RedWorkerMessageUpdate *msg = payload;
> @@ -8708,7 +8708,7 @@ static void dev_add_memslot(RedWorker *worker,
> QXLDevMemSlot mem_slot)
>                                mem_slot.generation);
>  }
>  
> -void handle_dev_add_memslot(void *opaque, void *payload)
> +static void handle_dev_add_memslot(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>      RedWorkerMessageAddMemslot *msg = payload;
> @@ -8719,7 +8719,7 @@ void handle_dev_add_memslot(void *opaque, void *payload)
>                                mem_slot.generation);
>  }
>  
> -void handle_dev_del_memslot(void *opaque, void *payload)
> +static void handle_dev_del_memslot(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>      RedWorkerMessageDelMemslot *msg = payload;
> @@ -8743,7 +8743,7 @@ void display_channel_destroy_surface_wait(DisplayChannel
> *display, int surface_i
>      red_clear_surface_drawables_from_pipes(display, surface_id, TRUE);
>  }
>  
> -void handle_dev_destroy_surface_wait(void *opaque, void *payload)
> +static void handle_dev_destroy_surface_wait(void *opaque, void *payload)
>  {
>      RedWorkerMessageDestroySurfaceWait *msg = payload;
>      RedWorker *worker = opaque;
> @@ -8782,7 +8782,7 @@ void display_channel_destroy_surfaces(DisplayChannel
> *display)
>      red_display_clear_glz_drawables(display);
>  }
>  
> -void handle_dev_destroy_surfaces(void *opaque, void *payload)
> +static void handle_dev_destroy_surfaces(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
> @@ -8874,7 +8874,7 @@ static void dev_create_primary_surface(RedWorker
> *worker, uint32_t surface_id,
>      cursor_channel_init(worker->cursor_channel, NULL);
>  }
>  
> -void handle_dev_create_primary_surface(void *opaque, void *payload)
> +static void handle_dev_create_primary_surface(void *opaque, void *payload)
>  {
>      RedWorkerMessageCreatePrimarySurface *msg = payload;
>      RedWorker *worker = opaque;
> @@ -8905,7 +8905,7 @@ static void destroy_primary_surface(RedWorker *worker,
> uint32_t surface_id)
>      cursor_channel_reset(worker->cursor_channel);
>  }
>  
> -void handle_dev_destroy_primary_surface(void *opaque, void *payload)
> +static void handle_dev_destroy_primary_surface(void *opaque, void *payload)
>  {
>      RedWorkerMessageDestroyPrimarySurface *msg = payload;
>      RedWorker *worker = opaque;
> @@ -8914,7 +8914,7 @@ void handle_dev_destroy_primary_surface(void *opaque,
> void *payload)
>      destroy_primary_surface(worker, surface_id);
>  }
>  
> -void handle_dev_destroy_primary_surface_async(void *opaque, void *payload)
> +static void handle_dev_destroy_primary_surface_async(void *opaque, void
> *payload)
>  {
>      RedWorkerMessageDestroyPrimarySurfaceAsync *msg = payload;
>      RedWorker *worker = opaque;
> @@ -8940,21 +8940,14 @@ static void dev_flush_surfaces(RedWorker *worker)
>      flush_all_surfaces(worker->display_channel);
>  }
>  
> -void handle_dev_flush_surfaces(void *opaque, void *payload)
> +static void handle_dev_flush_surfaces_async(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
>      dev_flush_surfaces(worker);
>  }
>  
> -void handle_dev_flush_surfaces_async(void *opaque, void *payload)
> -{
> -    RedWorker *worker = opaque;
> -
> -    dev_flush_surfaces(worker);
> -}
> -
> -void handle_dev_stop(void *opaque, void *payload)
> +static void handle_dev_stop(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
> @@ -9011,7 +9004,7 @@ static int
> display_channel_wait_for_migrate_data(DisplayChannel *display)
>      return FALSE;
>  }
>  
> -void handle_dev_start(void *opaque, void *payload)
> +static void handle_dev_start(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
> @@ -9029,7 +9022,7 @@ void handle_dev_start(void *opaque, void *payload)
>      guest_set_client_capabilities(worker);
>  }
>  
> -void handle_dev_wakeup(void *opaque, void *payload)
> +static void handle_dev_wakeup(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
> @@ -9037,7 +9030,7 @@ void handle_dev_wakeup(void *opaque, void *payload)
>      red_dispatcher_clear_pending(worker->red_dispatcher,
> RED_DISPATCHER_PENDING_WAKEUP);
>  }
>  
> -void handle_dev_oom(void *opaque, void *payload)
> +static void handle_dev_oom(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>      DisplayChannel *display = worker->display_channel;
> @@ -9071,14 +9064,14 @@ void handle_dev_oom(void *opaque, void *payload)
>      red_dispatcher_clear_pending(worker->red_dispatcher,
> RED_DISPATCHER_PENDING_OOM);
>  }
>  
> -void handle_dev_reset_cursor(void *opaque, void *payload)
> +static void handle_dev_reset_cursor(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
>      cursor_channel_reset(worker->cursor_channel);
>  }
>  
> -void handle_dev_reset_image_cache(void *opaque, void *payload)
> +static void handle_dev_reset_image_cache(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>      DisplayChannel *display = worker->display_channel;
> @@ -9086,7 +9079,7 @@ void handle_dev_reset_image_cache(void *opaque, void
> *payload)
>      image_cache_reset(&display->image_cache);
>  }
>  
> -void handle_dev_destroy_surface_wait_async(void *opaque, void *payload)
> +static void handle_dev_destroy_surface_wait_async(void *opaque, void
> *payload)
>  {
>      RedWorkerMessageDestroySurfaceWaitAsync *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9094,7 +9087,7 @@ void handle_dev_destroy_surface_wait_async(void *opaque,
> void *payload)
>      display_channel_destroy_surface_wait(worker->display_channel, msg-
> >surface_id);
>  }
>  
> -void handle_dev_destroy_surfaces_async(void *opaque, void *payload)
> +static void handle_dev_destroy_surfaces_async(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
> @@ -9103,7 +9096,7 @@ void handle_dev_destroy_surfaces_async(void *opaque,
> void *payload)
>      cursor_channel_reset(worker->cursor_channel);
>  }
>  
> -void handle_dev_create_primary_surface_async(void *opaque, void *payload)
> +static void handle_dev_create_primary_surface_async(void *opaque, void
> *payload)
>  {
>      RedWorkerMessageCreatePrimarySurfaceAsync *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9111,7 +9104,7 @@ void handle_dev_create_primary_surface_async(void
> *opaque, void *payload)
>      dev_create_primary_surface(worker, msg->surface_id, msg->surface);
>  }
>  
> -void handle_dev_display_connect(void *opaque, void *payload)
> +static void handle_dev_display_connect(void *opaque, void *payload)
>  {
>      RedWorkerMessageDisplayConnect *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9127,7 +9120,7 @@ void handle_dev_display_connect(void *opaque, void
> *payload)
>      free(msg->common_caps);
>  }
>  
> -void handle_dev_display_disconnect(void *opaque, void *payload)
> +static void handle_dev_display_disconnect(void *opaque, void *payload)
>  {
>      RedWorkerMessageDisplayDisconnect *msg = payload;
>      RedChannelClient *rcc = msg->rcc;
> @@ -9141,7 +9134,7 @@ void handle_dev_display_disconnect(void *opaque, void
> *payload)
>      red_channel_client_disconnect(rcc);
>  }
>  
> -void handle_dev_display_migrate(void *opaque, void *payload)
> +static void handle_dev_display_migrate(void *opaque, void *payload)
>  {
>      RedWorkerMessageDisplayMigrate *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9202,7 +9195,7 @@ static void handle_dev_monitors_config_async(void
> *opaque, void *payload)
>  }
>  
>  /* TODO: special, perhaps use another dispatcher? */
> -void handle_dev_cursor_connect(void *opaque, void *payload)
> +static void handle_dev_cursor_connect(void *opaque, void *payload)
>  {
>      RedWorkerMessageCursorConnect *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9218,7 +9211,7 @@ void handle_dev_cursor_connect(void *opaque, void
> *payload)
>      free(msg->common_caps);
>  }
>  
> -void handle_dev_cursor_disconnect(void *opaque, void *payload)
> +static void handle_dev_cursor_disconnect(void *opaque, void *payload)
>  {
>      RedWorkerMessageCursorDisconnect *msg = payload;
>      RedChannelClient *rcc = msg->rcc;
> @@ -9228,7 +9221,7 @@ void handle_dev_cursor_disconnect(void *opaque, void
> *payload)
>      red_channel_client_disconnect(rcc);
>  }
>  
> -void handle_dev_cursor_migrate(void *opaque, void *payload)
> +static void handle_dev_cursor_migrate(void *opaque, void *payload)
>  {
>      RedWorkerMessageCursorMigrate *msg = payload;
>      RedChannelClient *rcc = msg->rcc;
> @@ -9237,7 +9230,7 @@ void handle_dev_cursor_migrate(void *opaque, void
> *payload)
>      cursor_channel_client_migrate(CURSOR_CHANNEL_CLIENT(rcc));
>  }
>  
> -void handle_dev_set_compression(void *opaque, void *payload)
> +static void handle_dev_set_compression(void *opaque, void *payload)
>  {
>      RedWorkerMessageSetCompression *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9275,7 +9268,7 @@ void handle_dev_set_compression(void *opaque, void
> *payload)
>      display_channel_compress_stats_reset(worker->display_channel);
>  }
>  
> -void handle_dev_set_streaming_video(void *opaque, void *payload)
> +static void handle_dev_set_streaming_video(void *opaque, void *payload)
>  {
>      RedWorkerMessageSetStreamingVideo *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9283,7 +9276,7 @@ void handle_dev_set_streaming_video(void *opaque, void
> *payload)
>      display_channel_set_stream_video(worker->display_channel, msg-
> >streaming_video);
>  }
>  
> -void handle_dev_set_mouse_mode(void *opaque, void *payload)
> +static void handle_dev_set_mouse_mode(void *opaque, void *payload)
>  {
>      RedWorkerMessageSetMouseMode *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9292,7 +9285,7 @@ void handle_dev_set_mouse_mode(void *opaque, void
> *payload)
>      cursor_channel_set_mouse_mode(worker->cursor_channel, msg->mode);
>  }
>  
> -void handle_dev_add_memslot_async(void *opaque, void *payload)
> +static void handle_dev_add_memslot_async(void *opaque, void *payload)
>  {
>      RedWorkerMessageAddMemslotAsync *msg = payload;
>      RedWorker *worker = opaque;
> @@ -9300,14 +9293,14 @@ void handle_dev_add_memslot_async(void *opaque, void
> *payload)
>      dev_add_memslot(worker, msg->mem_slot);
>  }
>  
> -void handle_dev_reset_memslots(void *opaque, void *payload)
> +static void handle_dev_reset_memslots(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
>      red_memslot_info_reset(&worker->mem_slots);
>  }
>  
> -void handle_dev_driver_unload(void *opaque, void *payload)
> +static void handle_dev_driver_unload(void *opaque, void *payload)
>  {
>      RedWorker *worker = opaque;
>  
> @@ -9343,7 +9336,7 @@ static int loadvm_command(RedWorker *worker,
> QXLCommandExt *ext)
>      return TRUE;
>  }
>  
> -void handle_dev_loadvm_commands(void *opaque, void *payload)
> +static void handle_dev_loadvm_commands(void *opaque, void *payload)
>  {
>      RedWorkerMessageLoadvmCommands *msg = payload;
>      RedWorker *worker = opaque;


More information about the Spice-devel mailing list