Browse code

pipelimit: use unsigned to compute size and for iterator

Daniel-Constantin Mierla authored on 19/10/2020 08:09:59
Showing 1 changed files
... ...
@@ -137,10 +137,12 @@ int get_socket_list_from_proto_and_family(int **ipList, int protocol, int family
137 137
 	struct socket_info  *si;
138 138
 	struct socket_info** list;
139 139
 
140
-	int num_ip_octets   = family == AF_INET ? NUM_IP_OCTETS : NUM_IPV6_OCTETS;
141
-	int numberOfSockets = 0;
140
+	unsigned int num_ip_octets   = 0;
141
+	unsigned int numberOfSockets = 0;
142 142
 	int currentRow      = 0;
143 143
 
144
+	num_ip_octets = (family == AF_INET) ? NUM_IP_OCTETS : NUM_IPV6_OCTETS;
145
+
144 146
 	/* I hate to use #ifdefs, but this is necessary because of the way
145 147
 	 * get_sock_info_list() is defined.  */
146 148
 #ifndef USE_TCP
... ...
@@ -198,7 +200,7 @@ int get_socket_list_from_proto_and_family(int **ipList, int protocol, int family
198 200
 
199 201
 	/* Extract out the IP Addresses and ports.  */
200 202
 	for(si=list?*list:0; si; si=si->next){
201
-		int i;
203
+		unsigned int i;
202 204
 
203 205
 		/* We currently only support IPV4. */
204 206
 		if (si->address.af != family) {