[PATCH 7/7] glamor: Use ARRAY_SIZE in a couple more places for consistency.
Alex Deucher
alexdeucher at gmail.com
Wed Jul 1 06:54:13 PDT 2015
On Tue, Jun 30, 2015 at 6:58 PM, Eric Anholt <eric at anholt.net> wrote:
> Signed-off-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> glamor/glamor_program.c | 6 ++----
> glamor/glamor_render.c | 5 +----
> 2 files changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
> index 5619216..416c54a 100644
> --- a/glamor/glamor_program.c
> +++ b/glamor/glamor_program.c
> @@ -145,8 +145,6 @@ static glamor_location_var location_vars[] = {
> },
> };
>
> -#define NUM_LOCATION_VARS (sizeof location_vars / sizeof location_vars[0])
> -
> static char *
> add_var(char *cur, const char *add)
> {
> @@ -170,7 +168,7 @@ vs_location_vars(glamor_program_location locations)
> int l;
> char *vars = strdup("");
>
> - for (l = 0; vars && l < NUM_LOCATION_VARS; l++)
> + for (l = 0; vars && l < ARRAY_SIZE(location_vars); l++)
> if (locations & location_vars[l].location)
> vars = add_var(vars, location_vars[l].vs_vars);
> return vars;
> @@ -182,7 +180,7 @@ fs_location_vars(glamor_program_location locations)
> int l;
> char *vars = strdup("");
>
> - for (l = 0; vars && l < NUM_LOCATION_VARS; l++)
> + for (l = 0; vars && l < ARRAY_SIZE(location_vars); l++)
> if (locations & location_vars[l].location)
> vars = add_var(vars, location_vars[l].fs_vars);
> return vars;
> diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c
> index 22480cd..004cd89 100644
> --- a/glamor/glamor_render.c
> +++ b/glamor/glamor_render.c
> @@ -770,10 +770,7 @@ combine_pict_format(PictFormatShort * des, const PictFormatShort src,
> return TRUE;
> }
>
> - for (i = 0;
> - i <
> - sizeof(pict_format_combine_tab) /
> - sizeof(pict_format_combine_tab[0]); i++) {
> + for (i = 0; i < ARRAY_SIZE(pict_format_combine_tab); i++) {
> if ((src_type == pict_format_combine_tab[i][0]
> && mask_type == pict_format_combine_tab[i][1])
> || (src_type == pict_format_combine_tab[i][1]
> --
> 2.1.4
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list