From ae14e623a6593cc7ab1804ba15014c322c2877c7 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 7 May 2025 15:27:32 +0200 Subject: [PATCH] plug-ins: just use TRUE/FALSE instead of new macros. Small follow-up from !2097. To be fair, looking at this plug-in's code, we should also go much further, because so many useful types are defined while we could use GLib types. But I don't want to get into this cleanup rabbit hole right now. --- plug-ins/selection-to-path/curve.c | 2 +- plug-ins/selection-to-path/edge.c | 6 ++-- plug-ins/selection-to-path/fit.c | 44 +++++++++++++++--------------- plug-ins/selection-to-path/types.h | 2 -- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/plug-ins/selection-to-path/curve.c b/plug-ins/selection-to-path/curve.c index afb157c3e7..9b497d704b 100644 --- a/plug-ins/selection-to-path/curve.c +++ b/plug-ins/selection-to-path/curve.c @@ -33,7 +33,7 @@ new_curve (void) curve->point_list = NULL; CURVE_LENGTH (curve) = 0; - CURVE_CYCLIC (curve) = false; + CURVE_CYCLIC (curve) = FALSE; CURVE_START_TANGENT (curve) = CURVE_END_TANGENT (curve) = NULL; PREVIOUS_CURVE (curve) = NEXT_CURVE (curve) = NULL; diff --git a/plug-ins/selection-to-path/edge.c b/plug-ins/selection-to-path/edge.c index 8aa20beff5..f5bbff6e5d 100644 --- a/plug-ins/selection-to-path/edge.c +++ b/plug-ins/selection-to-path/edge.c @@ -204,7 +204,7 @@ is_outline_edge (edge_type edge, { /* If this pixel isn't black, it's not part of the outline. */ if (sel_pixel_is_white(row, col)) - return false; + return FALSE; switch (edge) { @@ -232,7 +232,7 @@ is_outline_edge (edge_type edge, /* If EDGE is not already marked, we mark it; otherwise, it's a fatal error. The position ROW and COL should be inside the bitmap MARKED. EDGE can - be `no_edge'; we just return false. */ + be `no_edge'; we just return FALSE. */ void mark_edge (edge_type edge, unsigned row, unsigned col, bitmap_type *marked) @@ -251,7 +251,7 @@ static boolean is_marked_edge (edge_type edge, unsigned row, unsigned col, bitmap_type marked) { return - edge == no_edge ? false : BITMAP_PIXEL (marked, row, col) & (1 << edge); + edge == no_edge ? FALSE : BITMAP_PIXEL (marked, row, col) & (1 << edge); } diff --git a/plug-ins/selection-to-path/fit.c b/plug-ins/selection-to-path/fit.c index 6ab247b74b..f46932a65a 100644 --- a/plug-ins/selection-to-path/fit.c +++ b/plug-ins/selection-to-path/fit.c @@ -90,7 +90,7 @@ unsigned filter_surround = 2; /* Says whether or not to remove ``knee'' points after finding the outline. (See the comments at `remove_knee_points'.) (-remove-knees). */ -boolean keep_knees = false; +boolean keep_knees = FALSE; /* If a spline is closer to a straight line than this, it remains a straight line, even if it would otherwise be changed back to a curve. @@ -436,7 +436,7 @@ split_at_corners (pixel_outline_list_type pixel_list) append_pixel (curve, O_COORDINATE (pixel_o, p)); /* This curve is cyclic. */ - CURVE_CYCLIC (curve) = true; + CURVE_CYCLIC (curve) = TRUE; } else { /* Each curve consists of the points between (inclusive) each pair @@ -538,7 +538,7 @@ find_corners (pixel_outline_type pixel_outline) unsigned q = p; unsigned i = p + 1; - while (true) + while (TRUE) { /* Perhaps the angle is sufficiently small that we want to consider this a corner, even if it's not the best @@ -763,7 +763,7 @@ remove_adjacent_corners (index_list_type *list, unsigned last_index) Since the first and last points are corners (unless the curve is cyclic), it doesn't make sense to remove those. */ -/* This evaluates to true if the vector V is zero in one direction and +/* This evaluates to TRUE if the vector V is zero in one direction and nonzero in the other. */ #define ONLY_ONE_ZERO(v) \ (((v).dx == 0.0 && (v).dy != 0.0) || ((v).dy == 0.0 && (v).dx != 0.0)) @@ -963,7 +963,7 @@ filter (curve_type curve) *curve = *new_curve; } -/* log_curve (curve, false); */ +/* log_curve (curve, FALSE); */ /* display_curve (curve); */ } @@ -1107,14 +1107,14 @@ fit_with_least_squares (curve_type curve) more coherent. */ /* LOG ("Finding tangents:\n"); */ - find_tangent (curve, /* to_start */ true, /* cross_curve */ false); - find_tangent (curve, /* to_start */ false, /* cross_curve */ false); + find_tangent (curve, /* to_start */ TRUE, /* cross_curve */ FALSE); + find_tangent (curve, /* to_start */ FALSE, /* cross_curve */ FALSE); set_initial_parameter_values (curve); /* Now we loop, reparameterizing and/or subdividing, until CURVE has been fit. */ - while (true) + while (TRUE) { /* LOG (" fitted to spline:\n"); */ @@ -1223,9 +1223,9 @@ fit_with_least_squares (curve_type curve) the subdivision point. The tangent at that point must be the same for both curves, or noticeable bumps will occur in the character. But we want to use information on both sides of the - point to compute the tangent, hence cross_curve = true. */ - find_tangent (left_curve, /* to_start_point: */ false, - /* cross_curve: */ true); + point to compute the tangent, hence cross_curve = TRUE. */ + find_tangent (left_curve, /* to_start_point: */ FALSE, + /* cross_curve: */ TRUE); CURVE_START_TANGENT (right_curve) = CURVE_END_TANGENT (left_curve); /* Now that we've set up the curves, we can fit them. */ @@ -1434,7 +1434,7 @@ reparameterize (curve_type curve, spline_type S) /* REPORT ("!"); */ /* LOG3 (" Stopped reparameterizing; %.3f > %.3f at point %u.\n", */ /* new_distance, old_distance, p); */ - return false; + return FALSE; } /* The t value might be negative or > 1, if the choice of control @@ -1443,9 +1443,9 @@ reparameterize (curve_type curve, spline_type S) doesn't matter. (Although it is a little unconventional.) */ } /* LOG (" reparameterized curve:\n "); */ -/* log_curve (curve, true); */ +/* log_curve (curve, TRUE); */ - return true; + return TRUE; } /* This routine finds the best place to subdivide the curve CURVE, @@ -1534,7 +1534,7 @@ test_subdivision_point (curve_type curve, unsigned index, vector_type *best) { unsigned count; vector_type in, out; - boolean join = false; + boolean join = FALSE; find_curve_vectors (index, curve, subdivide_surround, &in, &out, &count); @@ -1591,8 +1591,8 @@ set_initial_parameter_values (curve_type curve) } /* Find an approximation to the tangent to an endpoint of CURVE (to the - first point if TO_START_POINT is true, else the last). If - CROSS_CURVE is true, consider points on the adjacent curve to CURVE. + first point if TO_START_POINT is TRUE, else the last). If + CROSS_CURVE is TRUE, consider points on the adjacent curve to CURVE. It is important to compute an accurate approximation, because the control points that we eventually decide upon to fit the curve will @@ -1807,7 +1807,7 @@ static void change_bad_lines (spline_list_type *spline_list) { unsigned this_spline; - boolean found_cubic = false; + boolean found_cubic = FALSE; unsigned length = SPLINE_LIST_LENGTH (*spline_list); /* LOG1 ("\nChecking for bad lines (length %u):\n", length); */ @@ -1817,7 +1817,7 @@ change_bad_lines (spline_list_type *spline_list) { if (SPLINE_DEGREE (SPLINE_LIST_ELT (*spline_list, this_spline)) == CUBIC) { - found_cubic = true; + found_cubic = TRUE; break; } } @@ -1868,7 +1868,7 @@ change_bad_lines (spline_list_type *spline_list) START_POINT (*s).axis = END_POINT (*s).axis \ = END_POINT (*prev).axis = START_POINT (*next).axis \ = (start.axis + end.axis) / 2; \ - spline_change = true; \ + spline_change = TRUE; \ } \ } \ while (0) @@ -1884,13 +1884,13 @@ align (spline_list_type *l) do { - change = false; + change = FALSE; /* LOG (" "); */ for (this_spline = 0; this_spline < length; this_spline++) { - boolean spline_change = false; + boolean spline_change = FALSE; spline_type *s = &SPLINE_LIST_ELT (*l, this_spline); real_coordinate_type start = START_POINT (*s); real_coordinate_type end = END_POINT (*s); diff --git a/plug-ins/selection-to-path/types.h b/plug-ins/selection-to-path/types.h index 1521937b15..e6cac3dd9d 100644 --- a/plug-ins/selection-to-path/types.h +++ b/plug-ins/selection-to-path/types.h @@ -21,8 +21,6 @@ /* Cope with C23 */ typedef int boolean; -#define false FALSE -#define true TRUE /* The usual null-terminated string. */ typedef char *string;