Browse code

- more warning fixes (sun cc 64 bit; gcc netbsd sparc64, openbsd 3.2, freebsd 4.9,; intel icc linux) - replaced alloca in nathelper (alloca.h must be included on solaris, but it doesn't exist on bsds=> easier to remove it than #ifdef OS)

Andrei Pelinescu-Onciul authored on 15/07/2004 21:18:34
Showing 3 changed files
... ...
@@ -77,9 +77,6 @@ union sockaddr_union{
77 77
 };
78 78
 
79 79
 
80
-
81
-enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2 };
82
-
83 80
 struct socket_info{
84 81
 	int socket;
85 82
 	str name; /* name - eg.: foo.bar or 10.0.0.1 */
... ...
@@ -87,11 +84,10 @@ struct socket_info{
87 84
 	str address_str;        /* ip address converted to string -- optimization*/
88 85
 	unsigned short port_no;  /* port number */
89 86
 	str port_no_str; /* port number converted to string -- optimization*/
90
-	enum si_flags flags; /* SI_IS_IP | SI_IS_LO */
87
+	int is_ip; /* 1 if name is an ip address, 0 if not  -- optimization*/
88
+	int is_lo; /* 1 if is a loopback, 0 if not */
91 89
 	union sockaddr_union su; 
92 90
 	int proto; /* tcp or udp*/
93
-	struct socket_info* next;
94
-	struct socket_info* prev;
95 91
 };
96 92
 
97 93
 
... ...
@@ -381,15 +377,15 @@ static inline int hostent2su( union sockaddr_union* su,
381 377
 	return 0;
382 378
 }
383 379
 
384
-
385
-
380
+/* maximum size of a str returned by ip_addr2a (including \0) */
381
+#define IP_ADDR_MAX_STR_SIZE 40 /* 1234:5678:9012:3456:7890:1234:5678:9012\0 */
386 382
 /* fast ip_addr -> string convertor;
387 383
  * it uses an internal buffer
388 384
  */
389 385
 static inline char* ip_addr2a(struct ip_addr* ip)
390 386
 {
391 387
 
392
-	static char buff[40];/* 1234:5678:9012:3456:7890:1234:5678:9012\0 */
388
+	static char buff[IP_ADDR_MAX_STR_SIZE];
393 389
 	int offset;
394 390
 	register unsigned char a,b,c;
395 391
 #ifdef USE_IPV6
... ...
@@ -1237,10 +1237,12 @@ int t_lookup_callid(struct cell ** trans, str callid, str cseq) {
1237 1237
 
1238 1238
 	/* create header fields the same way tm does itself, then compare headers */
1239 1239
 	endpos = print_callid_mini(callid_header, callid);
1240
-	DBG("created comparable call_id header field: >%.*s<\n", endpos - callid_header, callid_header); 
1240
+	DBG("created comparable call_id header field: >%.*s<\n", 
1241
+			(int)(endpos - callid_header), callid_header); 
1241 1242
 
1242 1243
 	endpos = print_cseq_mini(cseq_header, &cseq, &invite_method);
1243
-	DBG("created comparable cseq header field: >%.*s<\n", endpos - cseq_header, cseq_header); 
1244
+	DBG("created comparable cseq header field: >%.*s<\n", 
1245
+			(int)(endpos - cseq_header), cseq_header); 
1244 1246
 
1245 1247
 	LOCK_HASH(hash_index);
1246 1248
 	DBG("just locked hash index %u, looking for transactions there:\n", hash_index);
... ...
@@ -180,7 +180,7 @@ static int tcp_blocking_connect(int fd, const struct sockaddr *servaddr,
180 180
 	struct timeval timeout;
181 181
 	int ticks;
182 182
 	int err;
183
-	int err_len;
183
+	unsigned int err_len;
184 184
 	
185 185
 again:
186 186
 	n=connect(fd, servaddr, addrlen);