diff options
author | Sam James <sam@gentoo.org> | 2023-11-05 22:09:21 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-11-05 22:09:21 +0000 |
commit | c84a13c576e25ee22b5441ac41338323822ba361 (patch) | |
tree | 78e0b60f66aa24f7aa4ef86a4c629ddfc1566d81 | |
parent | 36193ec952e68dbcf81aca408f5e1c3179135180 (diff) |
cairo-ps-surface: fix -Walloc-size
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/cairo-ps-surface.c:3524:18: warning: allocation of insufficient size ‘1’ for type ‘cairo_ps_form_t’ {aka ‘struct _cairo_ps_form’} with size ‘88’ [-Walloc-size]
```
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 struct of size `sizeof(cairo_ps_form_t)`. GCC then sees we're not
doing anything wrong.
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | src/cairo-ps-surface.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 381b4cf75..ad52918c2 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -3521,7 +3521,7 @@ _cairo_ps_surface_use_form (cairo_ps_surface_t *surface, unique_id_length = source_key.unique_id_length; memcpy (unique_id, source_key.unique_id, unique_id_length); - source_entry = calloc (sizeof (cairo_ps_form_t), 1); + source_entry = calloc (1, sizeof (cairo_ps_form_t)); if (source_entry == NULL) { status = _cairo_error (CAIRO_STATUS_NO_MEMORY); goto fail; |