From f6e2059a65c96a430df41a2c0e9bde3df31e6d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 28 May 2021 19:07:21 +0200 Subject: [PATCH] monitor: Replace some useless goto with clearer returns There was no point to use goto in place of normal returns here. Part-of: --- src/backends/meta-monitor.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index d4fb3c0bd..8eb0dc1e8 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -1672,7 +1672,7 @@ calculate_scale (MetaMonitor *monitor, &resolution_height); if (resolution_height < HIDPI_MIN_HEIGHT) - goto out; + return scale; /* 4K TV */ switch (meta_monitor_get_connector_type (monitor)) @@ -1680,7 +1680,7 @@ calculate_scale (MetaMonitor *monitor, case META_CONNECTOR_TYPE_HDMIA: case META_CONNECTOR_TYPE_HDMIB: if (resolution_width < SMALLEST_4K_WIDTH) - goto out; + return scale; break; default: break; @@ -1693,7 +1693,7 @@ calculate_scale (MetaMonitor *monitor, * size. */ if (meta_monitor_has_aspect_as_size (monitor)) - goto out; + return scale; if (width_mm > 0 && height_mm > 0) { @@ -1710,7 +1710,6 @@ calculate_scale (MetaMonitor *monitor, scale = 2.0; } -out: return scale; } @@ -1780,7 +1779,7 @@ get_closest_scale_factor_for_resolution (float width, best_scale = 0; if (!is_scale_valid_for_size (width, height, scale)) - goto out; + return best_scale; if (fmodf (width, scale) == 0.0 && fmodf (height, scale) == 0.0) return scale; @@ -1805,7 +1804,7 @@ get_closest_scale_factor_for_resolution (float width, current_scale < MINIMUM_SCALE_FACTOR || current_scale > MAXIMUM_SCALE_FACTOR) { - goto out; + return best_scale; } if (floorf (scaled_h) == scaled_h) @@ -1821,7 +1820,6 @@ get_closest_scale_factor_for_resolution (float width, } while (!found_one); -out: return best_scale; }