aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-26 17:08:30 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-26 17:08:30 +0200
commitd813e2d8d5ced94b7cc1ae15388228a5ef244769 (patch)
treece1be8827f26dbd9613ec7eef98c94c29f92760c
parentadd buf_size parameter tolibgamma_list_methods (diff)
downloadlibgamma-d813e2d8d5ced94b7cc1ae15388228a5ef244769.tar.gz
libgamma-d813e2d8d5ced94b7cc1ae15388228a5ef244769.tar.bz2
libgamma-d813e2d8d5ced94b7cc1ae15388228a5ef244769.tar.xz
Split out method naming to its own function
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--test/test.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/test/test.c b/test/test.c
index 4b499b3..65a65b6 100644
--- a/test/test.c
+++ b/test/test.c
@@ -21,6 +21,25 @@
#include <stdlib.h>
+static const char* method_name(int method)
+{
+ switch (method)
+ {
+ case GAMMA_METHOD_DUMMY: return "dummy";
+ case GAMMA_METHOD_X_RANDR: return "RandR X extension";
+ case GAMMA_METHOD_X_VIDMODE: return "VidMode X extension";
+ case GAMMA_METHOD_LINUX_DRM: return "Linux DRM";
+ case GAMMA_METHOD_W32_GDI: return "Windows GDI";
+ case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: return "Quartz using Core Graphics";
+ default:
+#if GAMMA_METHOD_COUNT != 6
+# warning List of adjustment methods is out of date
+#endif
+ return "(unknown)";
+ }
+}
+
+
int main(void)
{
int* methods = malloc(GAMMA_METHOD_COUNT * sizeof(int));
@@ -35,21 +54,7 @@ int main(void)
}
for (i = 0; i < n; i++)
- switch (methods[i])
- {
- case GAMMA_METHOD_DUMMY: printf("dummy\n"); break;
- case GAMMA_METHOD_X_RANDR: printf("RandR X extension\n"); break;
- case GAMMA_METHOD_X_VIDMODE: printf("VidMode X extension\n"); break;
- case GAMMA_METHOD_LINUX_DRM: printf("Linux DRM\n"); break;
- case GAMMA_METHOD_W32_GDI: printf("Windows GDI\n"); break;
- case GAMMA_METHOD_QUARTZ_CORE_GRAPHICS: printf("Quartz using Core Graphics\n"); break;
- default:
-#if GAMMA_METHOD_COUNT != 6
-# warning List of adjustment methods is out of date
-#endif
- printf("(unknown)\n");
- break;
- }
+ printf("%s\n", method_name(methods[i]));
return 0;
}