Browse code

core: removed obsolete DYN_BUF define condition

Daniel-Constantin Mierla authored on 21/05/2020 08:03:57
Showing 3 changed files
... ...
@@ -711,10 +711,7 @@ void free_sip_msg(struct sip_msg* const msg)
711 711
 	if (msg->body_lumps)  free_lump_list(msg->body_lumps);
712 712
 	if (msg->reply_lump)   free_reply_lump(msg->reply_lump);
713 713
 	msg_ldata_reset(msg);
714
-	/* don't free anymore -- now a pointer to a static buffer */
715
-#	ifdef DYN_BUF
716
-	pkg_free(msg->buf);
717
-#	endif
714
+	/* no free of msg->buf -- a pointer to a static buffer */
718 715
 }
719 716
 
720 717
 /**
... ...
@@ -1375,12 +1375,8 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
1375 1375
 		struct receive_info* rcv_info, struct tcp_connection* con)
1376 1376
 {
1377 1377
 #ifdef TCP_CLONE_RCVBUF
1378
-#ifdef DYN_BUF
1379
-	char *buf = NULL;
1380
-#else
1381 1378
 	static char *buf = NULL;
1382 1379
 	static unsigned int bsize = 0;
1383
-#endif
1384 1380
 	int blen;
1385 1381
 
1386 1382
 	/* cloning is disabled via parameter */
... ...
@@ -1404,13 +1400,6 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
1404 1404
 	if(blen < BUF_SIZE)
1405 1405
 		blen = BUF_SIZE;
1406 1406
 
1407
-#ifdef DYN_BUF
1408
-	buf=pkg_malloc(blen+1);
1409
-	if (buf==0) {
1410
-		PKG_MEM_ERROR;
1411
-		return -1;
1412
-	}
1413
-#else
1414 1407
 	/* allocate buffer when needed
1415 1408
 	 * - no buffer yet
1416 1409
 	 * - existing buffer too small (min size is BUF_SIZE - to accomodate most
... ...
@@ -1431,7 +1420,6 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
1431 1431
 		}
1432 1432
 		bsize = blen;
1433 1433
 	}
1434
-#endif
1435 1434
 
1436 1435
 	memcpy(buf, tcpbuf, len);
1437 1436
 	buf[len] = '\0';
... ...
@@ -422,11 +422,7 @@ error:
422 422
 int udp_rcv_loop()
423 423
 {
424 424
 	unsigned len;
425
-#ifdef DYN_BUF
426
-	char* buf;
427
-#else
428 425
 	static char buf [BUF_SIZE+1];
429
-#endif
430 426
 	char *tmp;
431 427
 	union sockaddr_union* fromaddr;
432 428
 	unsigned int fromaddrlen;
... ...
@@ -457,13 +453,6 @@ int udp_rcv_loop()
457 457
 	if (cfg_child_init()) goto error;
458 458
 
459 459
 	for(;;){
460
-#ifdef DYN_BUF
461
-		buf=pkg_malloc(BUF_SIZE+1);
462
-		if (buf==0){
463
-			PKG_MEM_ERROR;
464
-			goto error;
465
-		}
466
-#endif
467 460
 		fromaddrlen=sizeof(union sockaddr_union);
468 461
 		len=recvfrom(bind_address->socket, buf, BUF_SIZE, 0,
469 462
 				(struct sockaddr*)fromaddr, &fromaddrlen);