aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-03 05:59:45 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-03 05:59:45 +0200
commit18840f3a3b6839b7de6d902137dbd69cf5d77e1c (patch)
treeb232d4b27492b286e3ef34f10b50e594eee93347 /src/test
parentallocate the states on the heap (diff)
downloadlibgamma-18840f3a3b6839b7de6d902137dbd69cf5d77e1c.tar.gz
libgamma-18840f3a3b6839b7de6d902137dbd69cf5d77e1c.tar.bz2
libgamma-18840f3a3b6839b7de6d902137dbd69cf5d77e1c.tar.xz
put monitor selection in its own function
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 886b361..6c00d3d 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -177,23 +177,16 @@ static void error_test(void)
}
-int main(void)
+static int select_monitor(libgamma_site_state_t* restrict site_state,
+ libgamma_partition_state_t* restrict part_state,
+ libgamma_crtc_state_t* restrict crtc_state)
{
- libgamma_site_state_t* site_state = malloc(sizeof(libgamma_site_state_t));
- libgamma_partition_state_t* part_state = malloc(sizeof(libgamma_partition_state_t));
- libgamma_crtc_state_t* crtc_state = malloc(sizeof(libgamma_crtc_state_t));
int method;
char* site;
char* tmp;
char buf[256];
int r;
- list_methods_lists();
- method_availability();
- list_default_sites();
- method_capabilities();
- error_test();
-
printf("Select adjustment method:\n");
for (method = 0; method < LIBGAMMA_METHOD_COUNT; method++)
printf(" %i: %s\n", method, method_name(method));
@@ -256,6 +249,25 @@ int main(void)
return libgamma_perror("error", r), 1;
}
+ return 0;
+}
+
+
+int main(void)
+{
+ libgamma_site_state_t* restrict site_state = malloc(sizeof(libgamma_site_state_t));
+ libgamma_partition_state_t* restrict part_state = malloc(sizeof(libgamma_partition_state_t));
+ libgamma_crtc_state_t* restrict crtc_state = malloc(sizeof(libgamma_crtc_state_t));
+
+ list_methods_lists();
+ method_availability();
+ list_default_sites();
+ method_capabilities();
+ error_test();
+
+ if (select_monitor(site_state, part_state, crtc_state))
+ return 1;
+
libgamma_crtc_free(crtc_state);
libgamma_partition_free(part_state);
libgamma_site_free(site_state);