git: f9c59a50a327 - stable/13 - ministat: Consistently use item count as the first argument to calloc
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 30 Nov 2024 16:51:43 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=f9c59a50a327dbc74c37c3166dcd1beaafbed94b
commit f9c59a50a327dbc74c37c3166dcd1beaafbed94b
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-19 17:05:12 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-29 19:27:59 +0000
ministat: Consistently use item count as the first argument to calloc
Reported by: GCC 14 -Wcalloc-transposed-args
Reviewed by: rlibby, emaste
Differential Revision: https://reviews.freebsd.org/D46011
(cherry picked from commit a971c60456223b22c0b3c557d712b36660dbcff9)
---
usr.bin/ministat/ministat.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c
index 850c7408c272..b781ef37c50a 100644
--- a/usr.bin/ministat/ministat.c
+++ b/usr.bin/ministat/ministat.c
@@ -153,7 +153,7 @@ NewSet(void)
ds = calloc(1, sizeof *ds);
assert(ds != NULL);
ds->lpoints = 100000;
- ds->points = calloc(sizeof *ds->points, ds->lpoints);
+ ds->points = calloc(ds->lpoints, sizeof(*ds->points));
assert(ds->points != NULL);
ds->syy = NAN;
return(ds);
@@ -167,7 +167,7 @@ AddPoint(struct dataset *ds, double a)
if (ds->n >= ds->lpoints) {
dp = ds->points;
ds->lpoints *= 4;
- ds->points = calloc(sizeof *ds->points, ds->lpoints);
+ ds->points = calloc(ds->lpoints, sizeof(*ds->points));
assert(ds->points != NULL);
memcpy(ds->points, dp, sizeof *dp * ds->n);
free(dp);
@@ -356,7 +356,7 @@ PlotSet(struct dataset *ds, int val)
bar = 0;
if (pl->bar == NULL) {
- pl->bar = calloc(sizeof(char *), pl->num_datasets);
+ pl->bar = calloc(pl->num_datasets, sizeof(char *));
assert(pl->bar != NULL);
}