From 2b02ac2779e3243682b838fcc0da757daaab9106 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Tue, 12 Jul 2022 13:38:42 +0200 Subject: [PATCH] util/format: Use an explicit length for the descs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The script that generates the format tables does not set every pipe_format. In practice, the length of the format tables is equal to PIPE_FORMAT_COUNT. I just added the explicit size to future-proof it. (If the largest valid format is not part of the format tables, there will be a mismatch between the array length and PIPE_FORMAT_COUNT) Signed-off-by: Konstantin Seurer Reviewed-by: Alyssa Rosenzweig Reviewed-by: Marek Olšák Part-of: --- src/util/format/u_format_table.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/format/u_format_table.py b/src/util/format/u_format_table.py index a0943f4..12d365c 100644 --- a/src/util/format/u_format_table.py +++ b/src/util/format/u_format_table.py @@ -198,7 +198,7 @@ def write_format_table(formats): print() print('static const struct util_format_description') - print('util_format_descriptions[] = {') + print('util_format_descriptions[PIPE_FORMAT_COUNT] = {') for format in formats: sn = format.short_name() @@ -224,7 +224,7 @@ def write_format_table(formats): generate_table_getter("") print('static const struct util_format_pack_description') - print('util_format_pack_descriptions[] = {') + print('util_format_pack_descriptions[PIPE_FORMAT_COUNT] = {') for format in formats: sn = format.short_name() @@ -253,7 +253,7 @@ def write_format_table(formats): print() generate_table_getter("pack_") print('static const struct util_format_unpack_description') - print('util_format_unpack_descriptions[] = {') + print('util_format_unpack_descriptions[PIPE_FORMAT_COUNT] = {') for format in formats: sn = format.short_name() @@ -293,7 +293,7 @@ def write_format_table(formats): generate_table_getter("unpack_") - print('static const util_format_fetch_rgba_func_ptr util_format_fetch_rgba_table[] = {') + print('static const util_format_fetch_rgba_func_ptr util_format_fetch_rgba_table[PIPE_FORMAT_COUNT] = {') for format in formats: sn = format.short_name() -- 2.7.4