Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Nov 2025 04:12:12 GMT
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: eb411cd796fe - stable/13 - ipfilter: Calculate the number of elements in ipf_errors
Message-ID:  <202511140412.5AE4CCps086293@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/13 has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=eb411cd796fecdff37a9728b158fdda8f545a785

commit eb411cd796fecdff37a9728b158fdda8f545a785
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2025-10-23 02:11:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2025-11-12 04:02:31 +0000

    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
    Differential revision:  https://reviews.freebsd.org/D53308
    
    (cherry picked from commit ab3c9853285b4907dac147ce2f818e3fb44df5a3)
---
 sbin/ipf/libipf/interror.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/ipf/libipf/interror.c b/sbin/ipf/libipf/interror.c
index 994fb9d2b320..c2a0fa269149 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" },


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202511140412.5AE4CCps086293>