aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2025-10-23 02:11:20 +0000
committerCy Schubert <cy@FreeBSD.org>2025-11-05 15:32:16 +0000
commitab3c9853285b4907dac147ce2f818e3fb44df5a3 (patch)
tree5cbe9ee21b98c5451527bd9ace332ed7b58a16b6
parent768ee6d454821cc63247cb4ffe526c5a06accff0 (diff)
ipfilter: Calculate the number of elements in ipf_errors
It serves no purpose to manually manage the IPF_NUM_ERRORS count. Calculate it instead. Reviewed by: emaste, markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53308
-rw-r--r--sbin/ipf/libipf/interror.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ipf/libipf/interror.c b/sbin/ipf/libipf/interror.c
index 981823ca6bb9..cbfb210c85d3 100644
--- a/sbin/ipf/libipf/interror.c
+++ b/sbin/ipf/libipf/interror.c
@@ -17,7 +17,7 @@ typedef struct {
static ipf_error_entry_t *find_error(int);
-#define IPF_NUM_ERRORS 477
+#define IPF_NUM_ERRORS sizeof(ipf_errors) / sizeof(ipf_error_entry_t)
/*
* NO REUSE OF NUMBERS!
@@ -25,7 +25,7 @@ static ipf_error_entry_t *find_error(int);
* IF YOU WANT TO ADD AN ERROR TO THIS TABLE, _ADD_ A NEW NUMBER.
* DO _NOT_ USE AN EMPTY NUMBER OR FILL IN A GAP.
*/
-static ipf_error_entry_t ipf_errors[IPF_NUM_ERRORS] = {
+static ipf_error_entry_t ipf_errors[] = {
{ 1, "auth table locked/full" },
{ 2, "" },
{ 3, "copyinptr received bad address" },