diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-10-28 11:31:12 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-11-12 20:49:08 +0100 |
commit | de6a1e68fe89140d37fb4b64374c12a56b64f305 (patch) | |
tree | 27ff1989df7316ff6ffbb3328c152e76ad8acc36 /test/cairo-test.c | |
parent | c65d4e35dcdebc21d80c440944c11e1067743a8f (diff) | |
download | cairo-de6a1e68fe89140d37fb4b64374c12a56b64f305.tar.gz |
Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch:
// Remove useless checks for NULL before freeing
//
// free (NULL) is a no-op, so there is no need to avoid it
@@
expression E;
@@
+ free (E);
+ E = NULL;
- if (unlikely (E != NULL)) {
- free(E);
(
- E = NULL;
|
- E = 0;
)
...
- }
@@
expression E;
@@
+ free (E);
- if (unlikely (E != NULL)) {
- free (E);
- }
Diffstat (limited to 'test/cairo-test.c')
-rw-r--r-- | test/cairo-test.c | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/test/cairo-test.c b/test/cairo-test.c index 7dda8c239..0943f6743 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -228,8 +228,7 @@ cairo_test_fini (cairo_test_context_t *ctx) fclose (ctx->log_file); ctx->log_file = NULL; - if (ctx->ref_name != NULL) - free (ctx->ref_name); + free (ctx->ref_name); cairo_surface_destroy (ctx->ref_image); cairo_surface_destroy (ctx->ref_image_flattened); @@ -1387,18 +1386,11 @@ REPEAT: } UNWIND_CAIRO: - if (test_filename != NULL) { - free (test_filename); - test_filename = NULL; - } - if (fail_filename != NULL) { - free (fail_filename); - fail_filename = NULL; - } - if (pass_filename != NULL) { - free (pass_filename); - pass_filename = NULL; - } + free (test_filename); + free (fail_filename); + free (pass_filename); + + test_filename = fail_filename = pass_filename = NULL; #if HAVE_MEMFAULT if (ret == CAIRO_TEST_FAILURE) @@ -1442,32 +1434,19 @@ UNWIND_SURFACE: } UNWIND_STRINGS: - if (out_png_path) - free (out_png_path); - if (ref_png_path) - free (ref_png_path); - if (base_ref_png_path) - free (base_ref_png_path); - if (ref_path) - free (ref_path); - if (new_png_path) - free (new_png_path); - if (base_new_png_path) - free (base_new_png_path); - if (new_path) - free (new_path); - if (xfail_png_path) - free (xfail_png_path); - if (base_xfail_png_path) - free (base_xfail_png_path); - if (xfail_path) - free (xfail_path); - if (diff_png_path) - free (diff_png_path); - if (base_path) - free (base_path); - if (base_name) - free (base_name); + free (out_png_path); + free (ref_png_path); + free (base_ref_png_path); + free (ref_path); + free (new_png_path); + free (base_new_png_path); + free (new_path); + free (xfail_png_path); + free (base_xfail_png_path); + free (xfail_path); + free (diff_png_path); + free (base_path); + free (base_name); return ret; } |