util,compiler: Avoid use align as variable, replace it with other names

align is a function and when we want use it, the align variable will shadow it
So replace it with other names

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26885>
This commit is contained in:
Yonggang Luo 2023-11-03 03:58:53 +08:00 committed by Marge Bot
parent 5ff33f9905
commit b389bccccd
3 changed files with 14 additions and 14 deletions

View file

@ -1065,7 +1065,7 @@ const glsl_type *glsl_get_column_type(const glsl_type *t);
* The size/align func is only called for scalar and vector types and the
* returned type is otherwise laid out in the natural way as follows:
*
* - Arrays and matrices have a stride of ALIGN(elem_size, elem_align).
* - Arrays and matrices have a stride of align(elem_size, elem_align).
*
* - Structure types have their elements in-order and as tightly packed as
* possible following the alignment required by the size/align func.
@ -1079,7 +1079,7 @@ const glsl_type *glsl_get_column_type(const glsl_type *t);
*/
const glsl_type *glsl_get_explicit_type_for_size_align(const glsl_type *type,
glsl_type_size_align_func type_info,
unsigned *size, unsigned *align);
unsigned *size, unsigned *alignment);
const glsl_type *glsl_type_replace_vec3_with_vec4(const glsl_type *type);

View file

@ -803,23 +803,23 @@ create_slab(gc_ctx *ctx, unsigned bucket)
}
void *
gc_alloc_size(gc_ctx *ctx, size_t size, size_t align)
gc_alloc_size(gc_ctx *ctx, size_t size, size_t alignment)
{
assert(ctx);
assert(util_is_power_of_two_nonzero(align));
assert(util_is_power_of_two_nonzero(alignment));
align = MAX2(align, alignof(gc_block_header));
alignment = MAX2(alignment, alignof(gc_block_header));
/* Alignment will add at most align-alignof(gc_block_header) bytes of padding to the header, and
* the IS_PADDING byte can only encode up to 127.
*/
assert((align - alignof(gc_block_header)) <= 127);
assert((alignment - alignof(gc_block_header)) <= 127);
/* We can only align as high as the slab is. */
assert(align <= HEADER_ALIGN);
assert(alignment <= HEADER_ALIGN);
size_t header_size = align64(sizeof(gc_block_header), align);
size = align64(size, align);
size_t header_size = align64(sizeof(gc_block_header), alignment);
size = align64(size, alignment);
size += header_size;
gc_block_header *header = NULL;
@ -846,14 +846,14 @@ gc_alloc_size(gc_ctx *ctx, size_t size, size_t align)
if ((header_size - 1) != offsetof(gc_block_header, flags))
ptr[-1] = IS_PADDING | (header_size - sizeof(gc_block_header));
assert(((uintptr_t)ptr & (align - 1)) == 0);
assert(((uintptr_t)ptr & (alignment - 1)) == 0);
return ptr;
}
void *
gc_zalloc_size(gc_ctx *ctx, size_t size, size_t align)
gc_zalloc_size(gc_ctx *ctx, size_t size, size_t alignment)
{
void *ptr = gc_alloc_size(ctx, size, align);
void *ptr = gc_alloc_size(ctx, size, alignment);
if (likely(ptr))
memset(ptr, 0, size);

View file

@ -498,8 +498,8 @@ gc_ctx *gc_context(const void *parent);
#define gc_zalloc_zla(ctx, type, type2, count) \
gc_zalloc_size(ctx, sizeof(type) + sizeof(type2) * (count), MAX2(alignof(type), alignof(type2)))
void *gc_alloc_size(gc_ctx *ctx, size_t size, size_t align) MALLOCLIKE;
void *gc_zalloc_size(gc_ctx *ctx, size_t size, size_t align) MALLOCLIKE;
void *gc_alloc_size(gc_ctx *ctx, size_t size, size_t alignment) MALLOCLIKE;
void *gc_zalloc_size(gc_ctx *ctx, size_t size, size_t alignment) MALLOCLIKE;
void gc_free(void *ptr);
gc_ctx *gc_get_context(void *ptr);