[cairo] [PATCH 01/12] Sort option flags
Andrea Canciani
ranma42 at gmail.com
Sat Nov 12 13:19:53 PST 2011
Keep the option flags in alphabetical order. This makes it easier to
check for collisions or missing handlers.
Avoids an internal error when passing flags -c, -r or -v to
cairo-analyse-trace.
---
perf/cairo-analyse-trace.c | 2 +-
perf/cairo-perf-micro.c | 12 ++++++------
perf/cairo-perf-trace.c | 24 ++++++++++++------------
test/cairo-test-runner.c | 16 ++++++++--------
test/cairo-test-trace.c | 2 +-
5 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/perf/cairo-analyse-trace.c b/perf/cairo-analyse-trace.c
index ac2a4e7..6cd77f6 100644
--- a/perf/cairo-analyse-trace.c
+++ b/perf/cairo-analyse-trace.c
@@ -330,7 +330,7 @@ parse_options (cairo_perf_t *perf,
perf->num_exclude_names = 0;
while (1) {
- c = _cairo_getopt (argc, argv, "i:x:lrvc");
+ c = _cairo_getopt (argc, argv, "i:lx:");
if (c == -1)
break;
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index 61ed55f..63aad71 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -361,11 +361,16 @@ parse_options (cairo_perf_t *perf,
perf->summary = stdout;
while (1) {
- c = _cairo_getopt (argc, argv, "i:lrvf");
+ c = _cairo_getopt (argc, argv, "fi:lrv");
if (c == -1)
break;
switch (c) {
+ case 'f':
+ perf->fast_and_sloppy = TRUE;
+ if (ms == NULL)
+ perf->ms_per_iteration = CAIRO_PERF_ITERATION_MS_FAST;
+ break;
case 'i':
perf->exact_iterations = TRUE;
perf->iterations = strtoul (optarg, &end, 10);
@@ -382,11 +387,6 @@ parse_options (cairo_perf_t *perf,
perf->raw = TRUE;
perf->summary = NULL;
break;
- case 'f':
- perf->fast_and_sloppy = TRUE;
- if (ms == NULL)
- perf->ms_per_iteration = CAIRO_PERF_ITERATION_MS_FAST;
- break;
case 'v':
verbose = 1;
break;
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 8e637a7..3e5ba95 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -445,11 +445,14 @@ parse_options (cairo_perf_t *perf,
perf->num_exclude_names = 0;
while (1) {
- c = _cairo_getopt (argc, argv, "t:i:x:lsrvc");
+ c = _cairo_getopt (argc, argv, "ci:lrst:vx:");
if (c == -1)
break;
switch (c) {
+ case 'c':
+ use_surface_cache = 1;
+ break;
case 'i':
perf->exact_iterations = TRUE;
perf->iterations = strtoul (optarg, &end, 10);
@@ -459,14 +462,6 @@ parse_options (cairo_perf_t *perf,
exit (1);
}
break;
- case 't':
- perf->tile_size = strtoul (optarg, &end, 10);
- if (*end != '\0') {
- fprintf (stderr, "Invalid argument for -t (not an integer): %s\n",
- optarg);
- exit (1);
- }
- break;
case 'l':
perf->list_only = TRUE;
break;
@@ -477,12 +472,17 @@ parse_options (cairo_perf_t *perf,
case 's':
perf->observe = TRUE;
break;
+ case 't':
+ perf->tile_size = strtoul (optarg, &end, 10);
+ if (*end != '\0') {
+ fprintf (stderr, "Invalid argument for -t (not an integer): %s\n",
+ optarg);
+ exit (1);
+ }
+ break;
case 'v':
verbose = 1;
break;
- case 'c':
- use_surface_cache = 1;
- break;
case 'x':
if (! read_excludes (perf, optarg)) {
fprintf (stderr, "Invalid argument for -x (not readable file): %s\n",
diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c
index 28e4b5d..c0a7e95 100644
--- a/test/cairo-test-runner.c
+++ b/test/cairo-test-runner.c
@@ -367,7 +367,7 @@ _parse_cmdline (cairo_test_runner_t *runner, int *argc, char **argv[])
int c;
while (1) {
- c = _cairo_getopt (*argc, *argv, ":afkxsl");
+ c = _cairo_getopt (*argc, *argv, ":afklsx");
if (c == -1)
break;
@@ -375,21 +375,21 @@ _parse_cmdline (cairo_test_runner_t *runner, int *argc, char **argv[])
case 'a':
runner->full_test = TRUE;
break;
- case 's':
- runner->slow = TRUE;
+ case 'f':
+ runner->foreground = TRUE;
+ break;
+ case 'k':
+ runner->keyword_match = TRUE;
break;
case 'l':
runner->list_only = TRUE;
break;
- case 'f':
- runner->foreground = TRUE;
+ case 's':
+ runner->slow = TRUE;
break;
case 'x':
runner->exit_on_failure = TRUE;
break;
- case 'k':
- runner->keyword_match = TRUE;
- break;
default:
fprintf (stderr, "Internal error: unhandled option: %c\n", c);
/* fall-through */
diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c
index fb1bd42..89ef651 100644
--- a/test/cairo-test-trace.c
+++ b/test/cairo-test-trace.c
@@ -1554,7 +1554,7 @@ parse_options (test_trace_t *test, int argc, char *argv[])
test->num_exclude_names = 0;
while (1) {
- c = _cairo_getopt (argc, argv, "x:l");
+ c = _cairo_getopt (argc, argv, "lx:");
if (c == -1)
break;
--
1.7.5.4
More information about the cairo
mailing list