[cairo-commit] 3 commits - perf/cairo-perf-micro.c src/cairo-path-fixed.c src/cairo-stroke-style.c
Andrea Canciani
ranma42 at kemper.freedesktop.org
Mon Feb 20 03:33:32 PST 2012
perf/cairo-perf-micro.c | 10 +++++++---
src/cairo-path-fixed.c | 2 +-
src/cairo-stroke-style.c | 2 +-
3 files changed, 9 insertions(+), 5 deletions(-)
New commits:
commit 58f79a85b0d37ab9ccf9e6d706c202a6078e9140
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Sun Feb 19 18:25:06 2012 +0100
perf: Don't use a boolean value as integer
Although in this case the boolean values are guaranteed to be 1/0,
using them as true/false (in an if condition) seems much saner than
using them to limit the number of iterations on a for loop.
Fixes:
cairo-perf-micro.c:221:5: warning: cannot optimize possibly infinite
loops [-Wunsafe-loop-optimizations]
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index 7aa20ca..d6b52c4 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -169,7 +169,7 @@ cairo_perf_run (cairo_perf_t *perf,
cairo_count_func_t count_func)
{
static cairo_bool_t first_run = TRUE;
- unsigned int i, similar, has_similar;
+ unsigned int i, similar, similar_iters;
cairo_time_t *times;
cairo_stats_t stats = {0.0, 0.0};
int low_std_dev_count;
@@ -217,8 +217,12 @@ cairo_perf_run (cairo_perf_t *perf,
free (filename);
}
- has_similar = cairo_perf_has_similar (perf);
- for (similar = 0; similar <= has_similar; similar++) {
+ if (cairo_perf_has_similar (perf))
+ similar_iters = 2;
+ else
+ similar_iters = 1;
+
+ for (similar = 0; similar < similar_iters; similar++) {
unsigned loops;
if (perf->summary) {
commit 86a7533d0a2bd5d3c9ce0c18074d11ed633162df
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Sun Feb 19 18:21:35 2012 +0100
stroke-style: Silence gcc warning
and make it more obvious that we're not doing OOB accesses.
They were not possible because of the parity constraint, but by
guarding the highest index with which we access the data in the loop,
the correctness information is completely contained in the loop code.
Fixes:
cairo-stroke-style.c:199:2: warning: cannot optimize loop, the loop
counter may overflow [-Wunsafe-loop-optimizations]
diff --git a/src/cairo-stroke-style.c b/src/cairo-stroke-style.c
index 9b7e407..3ebaf01 100644
--- a/src/cairo-stroke-style.c
+++ b/src/cairo-stroke-style.c
@@ -196,7 +196,7 @@ _cairo_stroke_style_dash_stroked (const cairo_stroke_style_t *style)
} else {
/* Even (0, 2, ...) dashes are on and simply counted for the coverage, odd dashes are off, thus
* their coverage is approximated based on the area covered by the caps of adjacent on dases. */
- for (i = 0; i < style->num_dashes; i+=2)
+ for (i = 0; i + 1 < style->num_dashes; i += 2)
stroked += style->dash[i] + cap_scale * MIN (style->dash[i+1], style->line_width);
}
commit d3b6e151a26de7cdf5b00cf3942e25185f4b6892
Author: Andrea Canciani <ranma42 at gmail.com>
Date: Sun Feb 19 17:20:49 2012 +0100
path-fixed: Silence gcc warnings
_cairo_path_fixed_last_op() contains an assertion, which gcc doesn't
like to inline. Since it is a static function, which basically
accesses a value, gcc will inline it anyway when assertions are
disabled, so remove the "inline" hint to reduce gcc warning noise when
doing debug builds.
Fixes:
cairo-path-fixed.c: In function '_cairo_path_fixed_drop_line_to':
cairo-path-fixed.c:373:1: warning: inlining failed in call to
'_cairo_path_fixed_last_op.isra.5.part.6': call is unlikely and code
size would grow [-Winline]
cairo-path-fixed.c:400:1: warning: called from here [-Winline]
...
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index 1e9a759..652e615 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -369,7 +369,7 @@ _cairo_path_fixed_destroy (cairo_path_fixed_t *path)
free (path);
}
-static inline cairo_path_op_t
+static cairo_path_op_t
_cairo_path_fixed_last_op (cairo_path_fixed_t *path)
{
cairo_path_buf_t *buf;
More information about the cairo-commit
mailing list