From gitlab-mirror at kemper.freedesktop.org Mon Nov 6 17:10:10 2023 From: gitlab-mirror at kemper.freedesktop.org (GitLab Mirror) Date: Mon, 6 Nov 2023 17:10:10 +0000 (UTC) Subject: [cairo-commit] 2 commits - src/cairo-ps-surface.c Message-ID: <20231106171010.828487619B@kemper.freedesktop.org> src/cairo-ps-surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f9358f26b851132248806da105341bbab415ba46 Merge: 36193ec95 c84a13c57 Author: Emmanuele Bassi Date: Mon Nov 6 17:10:07 2023 +0000 Merge branch 'alloc-size' into 'master' cairo-ps-surface: fix -Walloc-size See merge request cairo/cairo!525 commit c84a13c576e25ee22b5441ac41338323822ba361 Author: Sam James Date: Sun Nov 5 22:09:21 2023 +0000 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 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;