gsk: Fix a maybe-uninitialized warning

The compiler (gcc 13.2) thinks that `t` could be used uninitialised.
That’s obviously not the case, because there’s always going to be at
least one loop iteration due to the initial values of `t1` and `t2`.

Change the loop to a `do…while` to make that a bit clearer to the
compiler without making any functional changes to the code.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall
2024-04-12 12:08:03 +01:00
parent 680dba6524
commit 707e492f0d

View File

@@ -227,7 +227,7 @@ get_t_by_bisection (const GskCurve *curve,
t1 = 0;
t2 = 1;
while (t1 < t2)
do
{
t = (t1 + t2) / 2;
if (t == t1 || t == t2)
@@ -243,6 +243,7 @@ get_t_by_bisection (const GskCurve *curve,
else
t2 = t;
}
while (t1 < t2);
return t;
}