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
This commit is contained in:
@@ -152,7 +152,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);
|
||||
@@ -166,7 +166,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);
|
||||
@@ -355,7 +355,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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user