pixman: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 8 01:12:32 UTC 2023
pixman/pixman-bits-image.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 08115a4217e0cb783ab391c2d98edcc3f14d51b6
Author: Sam James <sam at gentoo.org>
Date: Tue Nov 7 22:30:51 2023 +0000
pixman-bits-image: fix -Walloc-size
GCC 14 introduces a new -Walloc-size included in -Wextra which gives (when forced
to be an error):
```
../pixman/pixman-bits-image.c: In function ‘create_bits’:
../pixman/pixman-bits-image.c:1273:16: error: allocation of insufficient size ‘1’ for type ‘uint32_t’ {aka ‘unsigned int’} with size ‘4’ [-Werror=alloc-size]
1273 | return calloc (buf_size, 1);
| ^~~~~~~~~~~~~~~~~~~~
```
The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```
So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 element of size `buf_size`. GCC then sees we're not
doing anything wrong.
Signed-off-by: Sam James <sam at gentoo.org>
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 1698d73..20353cf 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1270,7 +1270,7 @@ create_bits (pixman_format_code_t format,
*rowstride_bytes = stride;
if (clear)
- return calloc (buf_size, 1);
+ return calloc (1, buf_size);
else
return malloc (buf_size);
}
More information about the xorg-commit
mailing list