[RFC 2/6] net: protocols -- Use ARRAY_SIZE helper

Cyrill Gorcunov <[email protected]>
Newsgroups org.kernel.vger.trinity
Message-ID <[email protected]>
We're looking up over @protocols array so use appropriate
helper here instead of TRINITY_PF_MAX constant.

Signed-off-by: Cyrill Gorcunov <[email protected]>
---
 net/protocols.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/protocols.c b/net/protocols.c
index 891acfe..c4a4ae2 100644
--- a/net/protocols.c
+++ b/net/protocols.c
@@ -62,7 +62,7 @@ const char * get_proto_name(unsigned int proto)
 {
 	unsigned int i;
 
-	for (i = 0; i < TRINITY_PF_MAX; i++)
+	for (i = 0; i < ARRAY_SIZE(protocols); i++)
 		if (protocols[i].proto == proto)
 			return protocols[i].name;
 	return NULL;
@@ -83,13 +83,13 @@ void find_specific_proto(const char *protoarg)
 		}
 	} else {
 		/* we were passed a numeric arg. */
-		for (i = 0; i < TRINITY_PF_MAX; i++) {
+		for (i = 0; i < ARRAY_SIZE(protocols); i++) {
 			if (specific_proto == protocols[i].proto)
 				break;
 		}
 	}
 
-	if (i > TRINITY_PF_MAX) {
+	if (i > ARRAY_SIZE(protocols)) {
 		outputerr("Protocol unknown. Pass a numeric value [0-%d] or one of ", TRINITY_PF_MAX);
 		for (i = 0; i < ARRAY_SIZE(protocols); i++)
 			outputerr("%s ", protocols[i].name);
-- 
1.8.3.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.