[mutter] monitor: Replace some useless goto with clearer returns
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor: Replace some useless goto with clearer returns
- Date: Thu, 22 Jul 2021 14:58:45 +0000 (UTC)
commit f6e2059a65c96a430df41a2c0e9bde3df31e6d09
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Fri May 28 19:07:21 2021 +0200
monitor: Replace some useless goto with clearer returns
There was no point to use goto in place of normal returns here.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1878>
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 d4fb3c0bd7..8eb0dc1e8f 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]