jonas / tig

Text-mode interface for git
https://jonas.github.io/tig/
GNU General Public License v2.0
12.49k stars 611 forks source link

Don't use array size in function arguments #1269

Closed proski closed 1 year ago

proski commented 1 year ago

The declaration of argv_to_string() mismatched its definition. The definition had the array size, the declaration had not. Remove array sizes from all functions declared in argv.h.

Array sizes in function arguments don't ensure the code correctness but can give a wrong impression that the compiler would check the array size.

proski commented 1 year ago

I've checked that the code does correct checks for the argv size. The argv_to_* functions look for the NULL terminator. The argv_from_* functions fail if the resulting NULL terminated array would exceed SIZEOF_ARG in size. Both looks correct to me.

This is a very visible warning detected with -Wall both by gcc and clang. It's about time that we fix it so that -Wall can be enabled in all builds by default.

koutcher commented 1 year ago

LGTM, thanks.