Move RB_GENERATE_STATIC to top of file.

This commit is contained in:
Michael Grant
2026-08-08 09:19:39 +01:00
parent 509ad56006
commit cce975eb77

24
image.c
View File

@@ -101,6 +101,18 @@ static const struct image_backend image_backend_sixel = {
sixel_free_output, sixel_geometry_changed
};
/* Compare images by server ID. */
static int
image_cmp(struct image *a, struct image *b)
{
if (a->id < b->id)
return (-1);
if (a->id > b->id)
return (1);
return (0);
}
RB_GENERATE_STATIC(images, image, entry, image_cmp);
/* Find the image backend supported by a terminal. */
static const struct image_backend *
image_tty_find_backend(struct tty *tty)
@@ -164,18 +176,6 @@ image_tty_free(struct tty *tty, int send)
tty->image_data = NULL;
}
/* Compare images by server ID. */
static int
image_cmp(struct image *a, struct image *b)
{
if (a->id < b->id)
return (-1);
if (a->id > b->id)
return (1);
return (0);
}
RB_GENERATE_STATIC(images, image, entry, image_cmp);
/* Average a rectangle of image pixels into one fallback sample. */
static void
image_sample(struct image *im, uint64_t sample_x, uint64_t sample_y,