[Spice-devel] [PATCH spice-server 5/5] tests: Make variables static where possible

Jonathon Jongsma jjongsma at redhat.com
Fri Sep 1 22:03:13 UTC 2017


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Fri, 2017-09-01 at 15:12 +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/tests/test-display-base.c               | 12 ++++++------
>  server/tests/test-display-no-ssl.c             |  6 +++---
>  server/tests/test-display-resolution-changes.c |  4 ++--
>  server/tests/test-display-width-stride.c       |  4 ++--
>  server/tests/test-playback.c                   | 12 ++++++------
>  server/tests/test-two-servers.c                |  2 +-
>  6 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/server/tests/test-display-base.c b/server/tests/test-
> display-base.c
> index d01fb36b..3a1f4cae 100644
> --- a/server/tests/test-display-base.c
> +++ b/server/tests/test-display-base.c
> @@ -404,7 +404,7 @@ static void create_primary_surface(Test *test,
> uint32_t width,
>      spice_qxl_create_primary_surface(&test->qxl_instance, 0,
> &surface);
>  }
>  
> -QXLDevMemSlot slot = {
> +static QXLDevMemSlot slot = {
>  .slot_group_id = MEM_SLOT_GROUP_ID,
>  .slot_id = 0,
>  .generation = 0,
> @@ -464,9 +464,9 @@ static void get_init_info(SPICE_GNUC_UNUSED
> QXLInstance *qin,
>  // which cannot be done from red_worker context (not via dispatcher,
>  // since you get a deadlock, and it isn't designed to be done
>  // any other way, so no point testing that).
> -int commands_end = 0;
> -int commands_start = 0;
> -struct QXLCommandExt* commands[1024];
> +static int commands_end = 0;
> +static int commands_start = 0;
> +static struct QXLCommandExt* commands[1024];
>  
>  #define COMMANDS_SIZE SPICE_N_ELEMENTS(commands)
>  
> @@ -786,7 +786,7 @@ static void set_client_capabilities(QXLInstance
> *qin,
>      }
>  }
>  
> -QXLInterface display_sif = {
> +static QXLInterface display_sif = {
>      .base = {
>          .type = SPICE_INTERFACE_QXL,
>          .description = "test",
> @@ -852,7 +852,7 @@ static SpiceCharDeviceInterface vdagent_sif = {
>  
>  };
>  
> -SpiceCharDeviceInstance vdagent_sin = {
> +static SpiceCharDeviceInstance vdagent_sin = {
>      .base = {
>          .sif = &vdagent_sif.base,
>      },
> diff --git a/server/tests/test-display-no-ssl.c b/server/tests/test-
> display-no-ssl.c
> index 5a2fd2f4..a00dcc45 100644
> --- a/server/tests/test-display-no-ssl.c
> +++ b/server/tests/test-display-no-ssl.c
> @@ -27,10 +27,10 @@
>  #include <stdlib.h>
>  #include "test-display-base.h"
>  
> -SpiceCoreInterface *core;
> -SpiceTimer *ping_timer;
> +static SpiceCoreInterface *core;
> +static SpiceTimer *ping_timer;
>  
> -int ping_ms = 100;
> +static int ping_ms = 100;
>  
>  static void pinger(SPICE_GNUC_UNUSED void *opaque)
>  {
> diff --git a/server/tests/test-display-resolution-changes.c
> b/server/tests/test-display-resolution-changes.c
> index b247c97c..6186e5be 100644
> --- a/server/tests/test-display-resolution-changes.c
> +++ b/server/tests/test-display-resolution-changes.c
> @@ -24,9 +24,9 @@
>  #include <stdlib.h>
>  #include "test-display-base.h"
>  
> -SpiceTimer *ping_timer;
> +static SpiceTimer *ping_timer;
>  
> -int ping_ms = 100;
> +static int ping_ms = 100;
>  
>  static void pinger(void *opaque)
>  {
> diff --git a/server/tests/test-display-width-stride.c
> b/server/tests/test-display-width-stride.c
> index 778bbd77..063aae84 100644
> --- a/server/tests/test-display-width-stride.c
> +++ b/server/tests/test-display-width-stride.c
> @@ -24,9 +24,9 @@
>  #include <stdlib.h>
>  #include "test-display-base.h"
>  
> -SpiceTimer *ping_timer;
> +static SpiceTimer *ping_timer;
>  
> -int ping_ms = 100;
> +static int ping_ms = 100;
>  
>  static void pinger(void *opaque)
>  {
> diff --git a/server/tests/test-playback.c b/server/tests/test-
> playback.c
> index 9e53e322..9b2dcc10 100644
> --- a/server/tests/test-playback.c
> +++ b/server/tests/test-playback.c
> @@ -34,7 +34,7 @@
>   * it has actual merit. Also possibly to simulate network effects?)
>   * */
>  
> -SpicePlaybackInstance playback_instance;
> +static SpicePlaybackInstance playback_instance;
>  
>  static const SpicePlaybackInterface playback_sif = {
>      .base = {
> @@ -45,11 +45,11 @@ static const SpicePlaybackInterface playback_sif
> = {
>      }
>  };
>  
> -uint32_t *frame;
> -uint32_t num_samples;
> -SpiceTimer *playback_timer;
> -int playback_timer_ms;
> -SpiceCoreInterface *core;
> +static uint32_t *frame;
> +static uint32_t num_samples;
> +static SpiceTimer *playback_timer;
> +static int playback_timer_ms;
> +static SpiceCoreInterface *core;
>  
>  static void get_frame(void)
>  {
> diff --git a/server/tests/test-two-servers.c b/server/tests/test-two-
> servers.c
> index e9f4205c..43b3e19a 100644
> --- a/server/tests/test-two-servers.c
> +++ b/server/tests/test-two-servers.c
> @@ -23,7 +23,7 @@
>  #include <stdlib.h>
>  #include "test-display-base.h"
>  
> -SpiceCoreInterface *core;
> +static SpiceCoreInterface *core;
>  
>  static const int simple_commands[] = {
>      //SIMPLE_CREATE_SURFACE,


More information about the Spice-devel mailing list