summaryrefslogtreecommitdiffstats
path: root/source/helper.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-27 09:28:33 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-27 09:28:33 +0200
commitfcd9878a3b35b86851fa589f909c4cad2332de31 (patch)
treecf9f87843b7194d5466c3afd0b869f38a8815025 /source/helper.c
parent193dfa16bc8a8729d587bb8f04d545d91e3209a0 (diff)
[Config] Remove stray printf, add compiler hints.
Diffstat (limited to 'source/helper.c')
-rw-r--r--source/helper.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/helper.c b/source/helper.c
index 8208b1f6..ec4c2397 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -1080,8 +1080,7 @@ cairo_surface_t* cairo_image_surface_create_from_svg ( const gchar* file, int he
RsvgHandle * handle;
handle = rsvg_handle_new_from_file ( file, &error );
- if ( handle != NULL ) {
- cairo_t *cr;
+ if ( G_LIKELY ( handle != NULL ) ) {
RsvgDimensionData dimensions;
// Update DPI.
rsvg_handle_set_dpi ( handle, config.dpi );
@@ -1093,8 +1092,8 @@ cairo_surface_t* cairo_image_surface_create_from_svg ( const gchar* file, int he
(double) dimensions.width * scale,
(double) dimensions.height * scale );
gboolean failed = cairo_surface_status ( surface ) != CAIRO_STATUS_SUCCESS;
- if ( !failed ) {
- cr = cairo_create ( surface );
+ if ( G_LIKELY ( failed == FALSE ) ) {
+ cairo_t *cr = cairo_create ( surface );
cairo_scale ( cr, scale, scale );
failed = rsvg_handle_render_cairo ( handle, cr ) == FALSE;
cairo_destroy ( cr );
@@ -1104,13 +1103,13 @@ cairo_surface_t* cairo_image_surface_create_from_svg ( const gchar* file, int he
g_object_unref ( handle );
/** Rendering fails */
- if ( failed ) {
+ if ( G_UNLIKELY ( failed ) ){
g_warning ( "Failed to render file: '%s'", file );
cairo_surface_destroy ( surface );
surface = NULL;
}
}
- if ( error != NULL ) {
+ if ( G_UNLIKELY ( error != NULL ) ) {
g_warning ( "Failed to render SVG file: '%s': %s", file, error->message );
g_error_free ( error );
}