[Spice-devel] [spice-server] Remove use of spice_debug(NULL)

Jonathon Jongsma jjongsma at redhat.com
Tue Jun 13 19:22:54 UTC 2017


On Tue, 2017-06-13 at 19:08 +0200, Christophe Fergeau wrote:
> This is causing issues with potential improvements to the logging
> system, and I've always found this usage a bit odd anyway.
> This means we also need to remove -Wformat-zero-length from our
> CFLAGS
> to avoid warnings from the compiler.

Alternately just change all of these to a particular string to avoid
worrying about warnings at all. Something as simple as "x"? or "trace"?
"reached"? "Christophe was here"? ;)

I agree with the general idea though.


> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
>  m4/manywarnings.m4          |  1 -
>  server/char-device.c        |  2 +-
>  server/dcc.c                |  4 ++--
>  server/display-channel.c    |  6 +++---
>  server/main-channel.c       |  2 +-
>  server/mjpeg-encoder.c      |  2 +-
>  server/red-channel-client.c |  4 ++--
>  server/red-worker.c         |  4 ++--
>  server/reds.c               | 28 ++++++++++++++--------------
>  server/stream.c             |  2 +-
>  10 files changed, 27 insertions(+), 28 deletions(-)
> 
> diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
> index 4f701f4ea..dfe5a5542 100644
> --- a/m4/manywarnings.m4
> +++ b/m4/manywarnings.m4
> @@ -142,7 +142,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
>      -Wformat-security \
>      -Wformat-signedness \
>      -Wformat-y2k \
> -    -Wformat-zero-length \
>      -Wframe-address \
>      -Wfree-nonheap-object \
>      -Whsa \
> diff --git a/server/char-device.c b/server/char-device.c
> index ab0707fb1..6de471ff4 100644
> --- a/server/char-device.c
> +++ b/server/char-device.c
> @@ -862,7 +862,7 @@ void
> red_char_device_migrate_data_marshall_empty(SpiceMarshaller *m)
>  {
>      SpiceMigrateDataCharDevice *mig_data;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      mig_data = (SpiceMigrateDataCharDevice
> *)spice_marshaller_reserve_space(m,
>                                                                      
>         sizeof(*mig_data));
>      memset(mig_data, 0, sizeof(*mig_data));
> diff --git a/server/dcc.c b/server/dcc.c
> index dbc496c2f..8118d6424 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -1278,7 +1278,7 @@ static bool
> restore_surfaces_lossless(DisplayChannelClient *dcc,
>  {
>      uint32_t i;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      for (i = 0; i < mig_surfaces->num_surfaces; i++) {
>          uint32_t surface_id = mig_surfaces->surfaces[i].id;
>  
> @@ -1293,7 +1293,7 @@ static bool
> restore_surfaces_lossy(DisplayChannelClient *dcc,
>  {
>      uint32_t i;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      for (i = 0; i < mig_surfaces->num_surfaces; i++) {
>          uint32_t surface_id = mig_surfaces->surfaces[i].id;
>          SpiceMigrateDataRect *mig_lossy_rect;
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 3864419bd..129c85c31 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -1441,7 +1441,7 @@ bool
> display_channel_wait_for_migrate_data(DisplayChannel *display)
>          return FALSE;
>      }
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_warn_if_fail(g_list_length(clients) == 1);
>  
>      rcc = g_list_nth_data(clients, 0);
> @@ -2071,7 +2071,7 @@ void
> display_channel_destroy_surfaces(DisplayChannel *display)
>  {
>      int i;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      //to handle better
>      for (i = 0; i < NUM_SURFACES; ++i) {
>          if (display->priv->surfaces[i].context.canvas) {
> @@ -2180,7 +2180,7 @@ static void on_disconnect(RedChannelClient
> *rcc)
>      DisplayChannel *display;
>      DisplayChannelClient *dcc;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_return_if_fail(rcc != NULL);
>  
>      dcc = DISPLAY_CHANNEL_CLIENT(rcc);
> diff --git a/server/main-channel.c b/server/main-channel.c
> index d0183258e..e0384bb21 100644
> --- a/server/main-channel.c
> +++ b/server/main-channel.c
> @@ -250,7 +250,7 @@ static bool
> main_channel_handle_message(RedChannelClient *rcc, uint16_t type,
>  static bool main_channel_handle_migrate_flush_mark(RedChannelClient
> *rcc)
>  {
>      RedChannel *channel = red_channel_client_get_channel(rcc);
> -    spice_debug(NULL);
> +    spice_debug("");
>      main_channel_push_migrate_data_item(MAIN_CHANNEL(channel));
>      return TRUE;
>  }
> diff --git a/server/mjpeg-encoder.c b/server/mjpeg-encoder.c
> index 92801f1c8..b9b6edbb1 100644
> --- a/server/mjpeg-encoder.c
> +++ b/server/mjpeg-encoder.c
> @@ -1067,7 +1067,7 @@ static void
> mjpeg_encoder_handle_negative_client_stream_report(MJpegEncoder *enc
>  {
>      MJpegEncoderRateControl *rate_control = &encoder->rate_control;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>  
>      if ((rate_control->bit_rate_info.change_start_mm_time >
> report_end_frame_mm_time ||
>          !rate_control->bit_rate_info.change_start_mm_time) &&
> diff --git a/server/red-channel-client.c b/server/red-channel-
> client.c
> index 7224c37e8..022d6bcf1 100644
> --- a/server/red-channel-client.c
> +++ b/server/red-channel-client.c
> @@ -786,7 +786,7 @@ void
> red_channel_client_start_connectivity_monitoring(RedChannelClient
> *rcc, uin
>      if (!red_channel_client_is_connected(rcc)) {
>          return;
>      }
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_assert(timeout_ms > 0);
>      /*
>       * If latency_monitor is not active, we activate it in order to
> enable
> @@ -1742,7 +1742,7 @@ bool
> red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
>      uint64_t end_time;
>      gboolean item_in_pipe;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>  
>      if (timeout != -1) {
>          end_time = spice_get_monotonic_time_ns() + timeout;
> diff --git a/server/red-worker.c b/server/red-worker.c
> index 57e6abea4..f119abbeb 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -505,7 +505,7 @@ static void dev_create_primary_surface(RedWorker
> *worker, uint32_t surface_id,
>      uint8_t *line_0;
>      int error;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_warn_if_fail(surface_id == 0);
>      spice_warn_if_fail(surface.height != 0);
>  
> @@ -1022,7 +1022,7 @@ static void
> worker_handle_dispatcher_async_done(void *opaque,
>      RedWorker *worker = opaque;
>      RedWorkerMessageAsync *msg_async = payload;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      red_qxl_async_complete(worker->qxl, msg_async->cmd);
>  }
>  
> diff --git a/server/reds.c b/server/reds.c
> index 09b674d7b..cf9684cf3 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -501,7 +501,7 @@ void reds_client_disconnect(RedsState *reds,
> RedClient *client)
>          return;
>      }
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      /* disconnecting is set to prevent recursion because of the
> following:
>       * main_channel_client_on_disconnect->
>       *  reds_client_disconnect->red_client_destroy->main_channel...
> @@ -577,7 +577,7 @@ static void reds_disconnect(RedsState *reds)
>      GListIter iter;
>      RedClient *client;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      GLIST_FOREACH(reds->clients, iter, RedClient, client) {
>          reds_client_disconnect(reds, client);
>      }
> @@ -1627,7 +1627,7 @@ static void
> reds_mig_target_client_add(RedsState *reds, RedClient *client)
>      RedsMigTargetClient *mig_client;
>  
>      g_return_if_fail(reds);
> -    spice_debug(NULL);
> +    spice_debug("");
>      mig_client = spice_new0(RedsMigTargetClient, 1);
>      mig_client->client = client;
>      mig_client->reds = reds;
> @@ -1737,7 +1737,7 @@ static void reds_handle_main_link(RedsState
> *reds, RedLinkInfo *link)
>      int mig_target = FALSE;
>      RedChannelCapabilities caps;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_assert(reds->main_channel);
>  
>      link_mess = link->link_mess;
> @@ -1908,7 +1908,7 @@ int reds_on_migrate_dst_set_seamless(RedsState
> *reds, MainChannelClient *mcc, ui
>  
>  void reds_on_client_seamless_migrate_complete(RedsState *reds,
> RedClient *client)
>  {
> -    spice_debug(NULL);
> +    spice_debug("");
>      if (!reds_find_client(reds, client)) {
>          spice_debug("client no longer exists");
>          return;
> @@ -2624,7 +2624,7 @@ static void reds_send_mm_time(RedsState *reds)
>      if (!reds_main_channel_connected(reds)) {
>          return;
>      }
> -    spice_debug(NULL);
> +    spice_debug("");
>      main_channel_push_multi_media_time(reds->main_channel,
>                                         reds_get_mm_time() - reds-
> >mm_time_latency);
>  }
> @@ -2936,7 +2936,7 @@ static void reds_mig_release(RedServerConfig
> *config)
>  
>  static void reds_mig_started(RedsState *reds)
>  {
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_assert(reds->config->mig_spice);
>  
>      reds->mig_inprogress = TRUE;
> @@ -2987,7 +2987,7 @@ static void
> reds_migrate_channels_seamless(RedsState *reds)
>  
>  static void reds_mig_finished(RedsState *reds, int completed)
>  {
> -    spice_debug(NULL);
> +    spice_debug("");
>  
>      reds->mig_inprogress = TRUE;
>  
> @@ -3018,7 +3018,7 @@ static void reds_mig_switch(RedsState *reds)
>  static void migrate_timeout(void *opaque)
>  {
>      RedsState *reds = opaque;
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_assert(reds->mig_wait_connect || reds-
> >mig_wait_disconnect);
>      if (reds->mig_wait_connect) {
>          /* we will fall back to the switch host scheme when
> migration completes */
> @@ -4100,7 +4100,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_migrate_connect(SpiceServer *reds, const cha
>      SpiceMigrateInterface *sif;
>      int try_seamless;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_assert(reds->migration_interface);
>  
>      if (reds->expect_migrate) {
> @@ -4147,7 +4147,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_migrate_info(SpiceServer *reds, const char*
>                                            int port, int secure_port,
>                                            const char* cert_subject)
>  {
> -    spice_debug(NULL);
> +    spice_debug("");
>      spice_assert(!reds->migration_interface);
>  
>      if (!reds_set_migration_dest_info(reds, dest, port, secure_port,
> cert_subject)) {
> @@ -4158,7 +4158,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_migrate_info(SpiceServer *reds, const char*
>  
>  SPICE_GNUC_VISIBLE int spice_server_migrate_start(SpiceServer *reds)
>  {
> -    spice_debug(NULL);
> +    spice_debug("");
>      if (!reds->config->mig_spice) {
>          return -1;
>      }
> @@ -4170,7 +4170,7 @@ SPICE_GNUC_VISIBLE int
> spice_server_migrate_end(SpiceServer *reds, int completed
>      SpiceMigrateInterface *sif;
>      int ret = 0;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>  
>      spice_assert(reds->migration_interface);
>  
> @@ -4199,7 +4199,7 @@ complete:
>  /* interface for switch-host migration */
>  SPICE_GNUC_VISIBLE int spice_server_migrate_switch(SpiceServer
> *reds)
>  {
> -    spice_debug(NULL);
> +    spice_debug("");
>      if (reds->clients == NULL) {
>         return 0;
>      }
> diff --git a/server/stream.c b/server/stream.c
> index f6ff0de34..76c9d1cf1 100644
> --- a/server/stream.c
> +++ b/server/stream.c
> @@ -914,7 +914,7 @@ void stream_detach_and_stop(DisplayChannel
> *display)
>  {
>      RingItem *stream_item;
>  
> -    spice_debug(NULL);
> +    spice_debug("");
>      while ((stream_item = ring_get_head(&display->priv->streams))) {
>          Stream *stream = SPICE_CONTAINEROF(stream_item, Stream,
> link);
>  


More information about the Spice-devel mailing list