The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e3b777534baeb69a1ee88d0b18c76a68eacdb34e
commit e3b777534baeb69a1ee88d0b18c76a68eacdb34e Author: Konstantin Belousov <[email protected]> AuthorDate: 2024-09-14 13:15:20 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2024-09-15 06:30:13 +0000 procstat(1): make rlimit_param[] size assertion automatic Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D46619 --- usr.bin/procstat/procstat_rlimit.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c index 1881f8ddbebf..3900ef7dcc14 100644 --- a/usr.bin/procstat/procstat_rlimit.c +++ b/usr.bin/procstat/procstat_rlimit.c @@ -47,7 +47,7 @@ static struct { const char *name; const char *suffix; -} rlimit_param[15] = { +} rlimit_param[] = { {"cputime", "sec"}, {"filesize", "B "}, {"datasize", "B "}, @@ -65,9 +65,8 @@ static struct { {"umtxp", " "}, }; -#if RLIM_NLIMITS > 15 -#error "Resource limits have grown. Add new entries to rlimit_param[]." -#endif +_Static_assert(nitems(rlimit_param) == RLIM_NLIMITS, + "Resource limits have grown. Add new entries to rlimit_param[]."); static const char * humanize_rlimit(int indx, rlim_t limit)
