tests: Reuse G_N_ELEMENTS instead of COUNT

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Frediano Ziglio 2017-09-01 14:39:05 +01:00
parent e6cf0dd056
commit ea58b27aff
6 changed files with 6 additions and 8 deletions

View File

@ -468,7 +468,7 @@ int commands_end = 0;
int commands_start = 0;
struct QXLCommandExt* commands[1024];
#define COMMANDS_SIZE COUNT(commands)
#define COMMANDS_SIZE G_N_ELEMENTS(commands)
static void push_command(QXLCommandExt *ext)
{

View File

@ -21,8 +21,6 @@
#include <spice.h>
#include "basic-event-loop.h"
#define COUNT(x) ((sizeof(x)/sizeof(x[0])))
/*
* simple queue for commands.
* each command can have up to two parameters (grow as needed)

View File

@ -61,7 +61,7 @@ int main(void)
//spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESSION_OFF);
test_add_display_interface(test);
test_add_agent_interface(test->server);
test_set_simple_command_list(test, simple_commands, COUNT(simple_commands));
test_set_simple_command_list(test, simple_commands, G_N_ELEMENTS(simple_commands));
ping_timer = core->timer_add(pinger, NULL);
core->timer_start(ping_timer, ping_ms);

View File

@ -75,7 +75,7 @@ int main(void)
test = test_new(core);
//spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESSION_OFF);
test_add_display_interface(test);
test_set_command_list(test, commands, COUNT(commands));
test_set_command_list(test, commands, G_N_ELEMENTS(commands));
ping_timer = core->timer_add(pinger, test);
core->timer_start(ping_timer, ping_ms);

View File

@ -98,7 +98,7 @@ static Command commands[] = {
static void on_client_connected(Test *test)
{
test_set_command_list(test, commands, COUNT(commands));
test_set_command_list(test, commands, G_N_ELEMENTS(commands));
}
int main(void)

View File

@ -46,8 +46,8 @@ int main(void)
//spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESSION_OFF);
test_add_display_interface(t1);
test_add_display_interface(t2);
test_set_simple_command_list(t1, simple_commands, COUNT(simple_commands));
test_set_simple_command_list(t2, simple_commands, COUNT(simple_commands));
test_set_simple_command_list(t1, simple_commands, G_N_ELEMENTS(simple_commands));
test_set_simple_command_list(t2, simple_commands, G_N_ELEMENTS(simple_commands));
basic_event_loop_mainloop();
return 0;