[cairo] [PATCH] Remove some useless declarations found by scan-build
Bryce W. Harrington
b.harrington at samsung.com
Tue May 6 10:15:38 PDT 2014
On Sat, May 03, 2014 at 09:55:06PM +0200, Sylvestre Ledru wrote:
> On 02/05/2014 21:42, Bryce W. Harrington wrote:
> > On Fri, May 02, 2014 at 07:21:37PM +0200, Sylvestre Ledru wrote:
> >> Hello,
> >>
> >> The attached patch removes some useless declarations found by scan-build
> >> http://clang-analyzer.llvm.org/
> >>
> >> Don't hesitate if you want me to split the patch.
> >>
> >> Thanks,
> >> Sylvestre
> > It's fine to have these collected into one patch.
> >
> > These all look like good cleanups. By chance did you check 'make test'?
> Yes, my changes did not break any test.
>
> > I have a couple suggestions below after reviewing the changes, but
> > they're minor.
> >
> Thanks. Here is the updated patch.
Thanks, applied.
Bryce
> Sylvestre
>
> [0;0m>From 57f9cff5ca94dd44815b1aaa8214663c0929730a Mon Sep 17 00:00:00 2001[0;0m
> [0;0mFrom: Sylvestre Ledru <sylvestre at mozilla.com>[0;0m
> [0;0mDate: Fri, 2 May 2014 18:53:41 +0200[0;0m
> [0;0mSubject: [PATCH] Remove some useless declarations found by scan-build, the[0;0m
> [0;0m LLVM/clang static analyzer[0;0m
> [0;0m[0;0m
> [0;32m---[0;0m
> [0;0m src/cairo-contour.c | 1 -[0;0m
> [0;0m src/cairo-ft-font.c | 2 --[0;0m
> [0;0m src/cairo-path-stroke-polygon.c | 10 ----------[0;0m
> [0;0m src/cairo-xcb-connection-core.c | 2 --[0;0m
> [0;0m test/pdiff/lpyramid.c | 4 ++--[0;0m
> [0;0m test/tighten-bounds.c | 2 +-[0;0m
> [0;0m util/cairo-script/cairo-script-file.c | 1 -[0;0m
> [0;0m 7 files changed, 3 insertions(+), 19 deletions(-)[0;0m
> [0;0m[0;0m
> [0;34mdiff --git a/src/cairo-contour.c b/src/cairo-contour.c[0;0m
> [0;0mindex d356f4f..9ad75bd 100644[0;0m
> [0;32m--- a/src/cairo-contour.c[0;0m
> [1;32m+++ b/src/cairo-contour.c[0;0m
> [1;34m@@ -332,7 +332,6 @@ _cairo_contour_simplify (cairo_contour_t *contour, double tolerance)[0;0m
> [0;0m }[0;0m
> [0;0m [0;0m
> [0;0m /* stage2: polygon simplification using Douglas-Peucker */[0;0m
> [0;32m- simplified = FALSE;[0;0m
> [0;0m do {[0;0m
> [0;0m last = &contour->chain.points[0];[0;0m
> [0;0m iter_init (&furthest, contour);[0;0m
> [0;34mdiff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c[0;0m
> [0;0mindex e0b0f22..59df4fc 100644[0;0m
> [0;32m--- a/src/cairo-ft-font.c[0;0m
> [1;32m+++ b/src/cairo-ft-font.c[0;0m
> [1;34m@@ -741,7 +741,6 @@ _compute_transform (cairo_ft_font_transform_t *sf,[0;0m
> [0;0m double min_distance = DBL_MAX;[0;0m
> [0;0m cairo_bool_t magnify = TRUE;[0;0m
> [0;0m int i;[0;0m
> [0;32m- int best_i = 0;[0;0m
> [0;0m double best_x_size = 0;[0;0m
> [0;0m double best_y_size = 0;[0;0m
> [0;0m [0;0m
> [1;34m@@ -760,7 +759,6 @@ _compute_transform (cairo_ft_font_transform_t *sf,[0;0m
> [0;0m if ((magnify && distance >= 0) || fabs (distance) <= min_distance) {[0;0m
> [0;0m magnify = distance < 0;[0;0m
> [0;0m min_distance = fabs (distance);[0;0m
> [0;32m- best_i = i;[0;0m
> [0;0m best_x_size = x_size;[0;0m
> [0;0m best_y_size = y_size;[0;0m
> [0;0m }[0;0m
> [0;34mdiff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c[0;0m
> [0;0mindex 2c8fe5e..e5082bb 100644[0;0m
> [0;32m--- a/src/cairo-path-stroke-polygon.c[0;0m
> [1;32m+++ b/src/cairo-path-stroke-polygon.c[0;0m
> [1;34m@@ -1083,7 +1083,6 @@ spline_to (void *closure,[0;0m
> [0;0m _cairo_contour_add_point (&stroker->path, point);[0;0m
> [0;0m #endif[0;0m
> [0;0m if ((tangent->dx | tangent->dy) == 0) {[0;0m
> [0;32m- const cairo_point_t *inpt, *outpt;[0;0m
> [0;0m struct stroke_contour *outer;[0;0m
> [0;0m cairo_point_t t;[0;0m
> [0;0m int clockwise;[0;0m
> [1;34m@@ -1101,12 +1100,8 @@ spline_to (void *closure,[0;0m
> [0;0m [0;0m
> [0;0m clockwise = join_is_clockwise (&stroker->current_face, &face);[0;0m
> [0;0m if (clockwise) {[0;0m
> [0;32m- inpt = &stroker->current_face.cw;[0;0m
> [0;32m- outpt = &face.cw;[0;0m
> [0;0m outer = &stroker->cw;[0;0m
> [0;0m } else {[0;0m
> [0;32m- inpt = &stroker->current_face.ccw;[0;0m
> [0;32m- outpt = &face.ccw;[0;0m
> [0;0m outer = &stroker->ccw;[0;0m
> [0;0m }[0;0m
> [0;0m [0;0m
> [1;34m@@ -1121,7 +1116,6 @@ spline_to (void *closure,[0;0m
> [0;0m if ((face.dev_slope.x * stroker->current_face.dev_slope.x +[0;0m
> [0;0m face.dev_slope.y * stroker->current_face.dev_slope.y) < stroker->spline_cusp_tolerance)[0;0m
> [0;0m {[0;0m
> [0;32m- const cairo_point_t *inpt, *outpt;[0;0m
> [0;0m struct stroke_contour *outer;[0;0m
> [0;0m int clockwise = join_is_clockwise (&stroker->current_face, &face);[0;0m
> [0;0m [0;0m
> [1;34m@@ -1134,12 +1128,8 @@ spline_to (void *closure,[0;0m
> [0;0m contour_add_point (stroker, &stroker->ccw, &stroker->current_face.ccw);[0;0m
> [0;0m [0;0m
> [0;0m if (clockwise) {[0;0m
> [0;32m- inpt = &stroker->current_face.cw;[0;0m
> [0;32m- outpt = &face.cw;[0;0m
> [0;0m outer = &stroker->cw;[0;0m
> [0;0m } else {[0;0m
> [0;32m- inpt = &stroker->current_face.ccw;[0;0m
> [0;32m- outpt = &face.ccw;[0;0m
> [0;0m outer = &stroker->ccw;[0;0m
> [0;0m }[0;0m
> [0;0m add_fan (stroker,[0;0m
> [0;34mdiff --git a/src/cairo-xcb-connection-core.c b/src/cairo-xcb-connection-core.c[0;0m
> [0;0mindex 386297d..e01dc1a 100644[0;0m
> [0;32m--- a/src/cairo-xcb-connection-core.c[0;0m
> [1;32m+++ b/src/cairo-xcb-connection-core.c[0;0m
> [1;34m@@ -268,8 +268,6 @@ _cairo_xcb_connection_put_subimage (cairo_xcb_connection_t *connection,[0;0m
> [0;0m if (rows > height)[0;0m
> [0;0m rows = height;[0;0m
> [0;0m [0;0m
> [0;32m- length = rows * cpp * width;[0;0m
> [0;32m-[0;0m
> [0;0m _cairo_xcb_connection_do_put_subimage (connection, dst, gc, src_x, src_y,[0;0m
> [0;0m width, rows, cpp, stride, dst_x, dst_y, depth, _data);[0;0m
> [0;0m [0;0m
> [0;34mdiff --git a/test/pdiff/lpyramid.c b/test/pdiff/lpyramid.c[0;0m
> [0;0mindex aa57ca2..bd402c7 100644[0;0m
> [0;32m--- a/test/pdiff/lpyramid.c[0;0m
> [1;32m+++ b/test/pdiff/lpyramid.c[0;0m
> [1;34m@@ -111,6 +111,6 @@ lpyramid_get_value (lpyramid_t *pyramid, int x, int y, int level)[0;0m
> [0;0m int index = x + y * pyramid->width;[0;0m
> [0;0m int l = level;[0;0m
> [0;0m if (l > MAX_PYR_LEVELS)[0;0m
> [0;32m- l = MAX_PYR_LEVELS;[0;0m
> [0;32m- return pyramid->levels[level][index];[0;0m
> [1;32m+ l = MAX_PYR_LEVELS;[0;0m
> [1;32m+ return pyramid->levels[l][index];[0;0m
> [0;0m }[0;0m
> [0;34mdiff --git a/test/tighten-bounds.c b/test/tighten-bounds.c[0;0m
> [0;0mindex 02fc81a..f5430e4 100644[0;0m
> [0;32m--- a/test/tighten-bounds.c[0;0m
> [1;32m+++ b/test/tighten-bounds.c[0;0m
> [1;34m@@ -72,7 +72,7 @@ static void (* const path_funcs[])(cairo_t *cr, int size) = {[0;0m
> [0;0m static void[0;0m
> [0;0m draw_idx (cairo_t *cr, int i, int j, int type)[0;0m
> [0;0m {[0;0m
> [0;32m- cairo_bool_t little_path = type & (1 << 0);[0;0m
> [1;32m+ cairo_bool_t little_path;[0;0m
> [0;0m cairo_bool_t empty_clip;[0;0m
> [0;0m cairo_bool_t little_clip;[0;0m
> [0;0m [0;0m
> [0;34mdiff --git a/util/cairo-script/cairo-script-file.c b/util/cairo-script/cairo-script-file.c[0;0m
> [0;0mindex c962fce..0274a3e 100644[0;0m
> [0;32m--- a/util/cairo-script/cairo-script-file.c[0;0m
> [1;32m+++ b/util/cairo-script/cairo-script-file.c[0;0m
> [1;34m@@ -1063,7 +1063,6 @@ _csi_file_as_string (csi_t *ctx,[0;0m
> [0;0m unsigned int allocated;[0;0m
> [0;0m csi_status_t status;[0;0m
> [0;0m [0;0m
> [0;32m- len = 0;[0;0m
> [0;0m allocated = 16384;[0;0m
> [0;0m bytes = _csi_alloc (ctx, allocated);[0;0m
> [0;0m if (bytes == NULL)[0;0m
> [0;32m-- [0;0m
> [0;0m1.9.1[0;0m
> [0;0m[0;0m
More information about the cairo
mailing list