Reported by: GCC 14 -Wcalloc-transposed-args
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Some of these can be argued either way (is it one buffer of length ir_buflen, or is it a buffer of ir_buflen byte objects) but it's fine to do this just to placate GCC.
Yes, in general I avoided changing the ones that were an array of bytes (e.g. for strings or opaque buffers) as you can argue it either way (a single opaque buffer, or an array of bytes). In this case GCC only warned about the first one, but here I believe it is obvious that rather than being an opaque buffer, the second one is really allocating a struct isns_hdr object, so the size really should be the second argument there as well.
Also, given the number of changes to be fixed, and that in many cases it made individual files or programs more consistent (e.g. all but a small number of calls were already correct), I think I'd prefer to just leave the calloc warning enabled going forward rather than muting it.