aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/async.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-11-06 11:34:31 +0100
committerTobias Burnus <tobias@codesourcery.com>2023-11-06 11:43:28 +0100
commit17df6ddcf11aef6d200305d35641a7deb2f430e1 (patch)
tree14a82441c9e62e644ab1ee9331050185380fd893 /libgfortran/io/async.c
parentf463ef79ddb403570461343ebda0c1aeac85d5bb (diff)
downloadgcc-17df6ddcf11aef6d200305d35641a7deb2f430e1.zip
gcc-17df6ddcf11aef6d200305d35641a7deb2f430e1.tar.gz
gcc-17df6ddcf11aef6d200305d35641a7deb2f430e1.tar.bz2
libgfortran: Fix calloc call by swapping arg order [PR112364]
The prototype of calloc is void *calloc(size_t nmemb, size_t size); denoting "an array of nmemb objects, each of whose size is size." (C23) In order to follow the meaning of the argument names and to silence a -Walloc-size warning, this commit swaps the order of the two args to read now: calloc (1, sizeof (transfer_queue)); libgfortran/ChangeLog: PR libfortran/112364 * io/async.c (enqueue_transfer, enqueue_done_id, enqueue_done, enqueue_close): Swap 1st and 2nd arg in calloc call.
Diffstat (limited to 'libgfortran/io/async.c')
-rw-r--r--libgfortran/io/async.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libgfortran/io/async.c b/libgfortran/io/async.c
index 5709743..8fa1f0d 100644
--- a/libgfortran/io/async.c
+++ b/libgfortran/io/async.c
@@ -262,7 +262,7 @@ init_async_unit (gfc_unit *u)
void
enqueue_transfer (async_unit *au, transfer_args *arg, enum aio_do type)
{
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->arg = *arg;
tq->type = type;
tq->has_id = 0;
@@ -284,7 +284,7 @@ int
enqueue_done_id (async_unit *au, enum aio_do type)
{
int ret;
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->type = type;
tq->has_id = 1;
@@ -308,7 +308,7 @@ enqueue_done_id (async_unit *au, enum aio_do type)
void
enqueue_done (async_unit *au, enum aio_do type)
{
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->type = type;
tq->has_id = 0;
LOCK (&au->lock);
@@ -328,7 +328,7 @@ enqueue_done (async_unit *au, enum aio_do type)
void
enqueue_close (async_unit *au)
{
- transfer_queue *tq = calloc (sizeof (transfer_queue), 1);
+ transfer_queue *tq = calloc (1, sizeof (transfer_queue));
tq->type = AIO_CLOSE;
LOCK (&au->lock);