public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] Silence two instances of -Wcalloc-transposed-args
@ 2024-05-03  8:02 Peter Damianov
  2024-05-03 11:24 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Damianov @ 2024-05-03  8:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.guenther, Peter Damianov

libgcc/
	* libgcov-util.c (tag_counters): Swap order of arguments to xcalloc.
	(topen_to_memory_representation): Likewise.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
---
 libgcc/libgcov-util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
index ba4b90a480d..f443408c4ab 100644
--- a/libgcc/libgcov-util.c
+++ b/libgcc/libgcov-util.c
@@ -211,8 +211,8 @@ tag_counters (unsigned tag, int length)
   gcc_assert (k_ctrs[tag_ix].num == 0);
   k_ctrs[tag_ix].num = n_counts;
 
-  k_ctrs[tag_ix].values = values = (gcov_type *) xcalloc (sizeof (gcov_type),
-							  n_counts);
+  k_ctrs[tag_ix].values = values = (gcov_type *) xcalloc (n_counts,
+							  sizeof (gcov_type));
   gcc_assert (values);
 
   if (length > 0)
@@ -526,7 +526,7 @@ topn_to_memory_representation (struct gcov_ctr_info *info)
       if (n > 0)
 	{
 	  struct gcov_kvp *tuples
-	    = (struct gcov_kvp *)xcalloc (sizeof (struct gcov_kvp), n);
+	    = (struct gcov_kvp *)xcalloc (n, sizeof (struct gcov_kvp));
 	  for (unsigned i = 0; i < n - 1; i++)
 	    tuples[i].next = &tuples[i + 1];
 	  for (unsigned i = 0; i < n; i++)
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] Silence two instances of -Wcalloc-transposed-args
  2024-05-03  8:02 [PATCH v2] Silence two instances of -Wcalloc-transposed-args Peter Damianov
@ 2024-05-03 11:24 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2024-05-03 11:24 UTC (permalink / raw)
  To: Peter Damianov; +Cc: gcc-patches

On Fri, May 3, 2024 at 10:03 AM Peter Damianov <peter0x44@disroot.org> wrote:
>
> libgcc/
>         * libgcov-util.c (tag_counters): Swap order of arguments to xcalloc.
>         (topen_to_memory_representation): Likewise.

Thanks, I pushed this for you.

Richard.

> Signed-off-by: Peter Damianov <peter0x44@disroot.org>
> ---
>  libgcc/libgcov-util.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libgcc/libgcov-util.c b/libgcc/libgcov-util.c
> index ba4b90a480d..f443408c4ab 100644
> --- a/libgcc/libgcov-util.c
> +++ b/libgcc/libgcov-util.c
> @@ -211,8 +211,8 @@ tag_counters (unsigned tag, int length)
>    gcc_assert (k_ctrs[tag_ix].num == 0);
>    k_ctrs[tag_ix].num = n_counts;
>
> -  k_ctrs[tag_ix].values = values = (gcov_type *) xcalloc (sizeof (gcov_type),
> -                                                         n_counts);
> +  k_ctrs[tag_ix].values = values = (gcov_type *) xcalloc (n_counts,
> +                                                         sizeof (gcov_type));
>    gcc_assert (values);
>
>    if (length > 0)
> @@ -526,7 +526,7 @@ topn_to_memory_representation (struct gcov_ctr_info *info)
>        if (n > 0)
>         {
>           struct gcov_kvp *tuples
> -           = (struct gcov_kvp *)xcalloc (sizeof (struct gcov_kvp), n);
> +           = (struct gcov_kvp *)xcalloc (n, sizeof (struct gcov_kvp));
>           for (unsigned i = 0; i < n - 1; i++)
>             tuples[i].next = &tuples[i + 1];
>           for (unsigned i = 0; i < n; i++)
> --
> 2.39.2
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-03 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03  8:02 [PATCH v2] Silence two instances of -Wcalloc-transposed-args Peter Damianov
2024-05-03 11:24 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).