[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We're looking up over @protocols array so use appropriate
helper here instead of TRINITY_PF_MAX constant.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux