mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-30 21:54:50 +00:00
libcasper: 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/D46005
This commit is contained in:
parent
680f40f383
commit
5275d1ddb4
|
@ -85,7 +85,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
|
|||
hp->h_length = (int)nvlist_get_number(nvl, "length");
|
||||
|
||||
nitems = (unsigned int)nvlist_get_number(nvl, "naliases");
|
||||
hp->h_aliases = calloc(sizeof(hp->h_aliases[0]), nitems + 1);
|
||||
hp->h_aliases = calloc(nitems + 1, sizeof(hp->h_aliases[0]));
|
||||
if (hp->h_aliases == NULL)
|
||||
goto fail;
|
||||
for (ii = 0; ii < nitems; ii++) {
|
||||
|
@ -99,7 +99,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
|
|||
hp->h_aliases[ii] = NULL;
|
||||
|
||||
nitems = (unsigned int)nvlist_get_number(nvl, "naddrs");
|
||||
hp->h_addr_list = calloc(sizeof(hp->h_addr_list[0]), nitems + 1);
|
||||
hp->h_addr_list = calloc(nitems + 1, sizeof(hp->h_addr_list[0]));
|
||||
if (hp->h_addr_list == NULL)
|
||||
goto fail;
|
||||
for (ii = 0; ii < nitems; ii++) {
|
||||
|
|
|
@ -105,7 +105,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
|
|||
hp->h_length = (int)nvlist_get_number(nvl, "length");
|
||||
|
||||
nitems = (unsigned int)nvlist_get_number(nvl, "naliases");
|
||||
hp->h_aliases = calloc(sizeof(hp->h_aliases[0]), nitems + 1);
|
||||
hp->h_aliases = calloc(nitems + 1, sizeof(hp->h_aliases[0]));
|
||||
if (hp->h_aliases == NULL)
|
||||
goto fail;
|
||||
for (ii = 0; ii < nitems; ii++) {
|
||||
|
@ -119,7 +119,7 @@ hostent_unpack(const nvlist_t *nvl, struct hostent *hp)
|
|||
hp->h_aliases[ii] = NULL;
|
||||
|
||||
nitems = (unsigned int)nvlist_get_number(nvl, "naddrs");
|
||||
hp->h_addr_list = calloc(sizeof(hp->h_addr_list[0]), nitems + 1);
|
||||
hp->h_addr_list = calloc(nitems + 1, sizeof(hp->h_addr_list[0]));
|
||||
if (hp->h_addr_list == NULL)
|
||||
goto fail;
|
||||
for (ii = 0; ii < nitems; ii++) {
|
||||
|
|
Loading…
Reference in a new issue