Pārlūkot izejas kodu

core: removed obsolete DYN_BUF define condition

Daniel-Constantin Mierla 5 gadi atpakaļ
vecāks
revīzija
cbeec44d4c
3 mainītis faili ar 1 papildinājumiem un 27 dzēšanām
  1. 1 4
      src/core/parser/msg_parser.c
  2. 0 12
      src/core/tcp_read.c
  3. 0 11
      src/core/udp_server.c

+ 1 - 4
src/core/parser/msg_parser.c

@@ -711,10 +711,7 @@ void free_sip_msg(struct sip_msg* const msg)
 	if (msg->body_lumps)  free_lump_list(msg->body_lumps);
 	if (msg->reply_lump)   free_reply_lump(msg->reply_lump);
 	msg_ldata_reset(msg);
-	/* don't free anymore -- now a pointer to a static buffer */
-#	ifdef DYN_BUF
-	pkg_free(msg->buf);
-#	endif
+	/* no free of msg->buf -- a pointer to a static buffer */
 }
 
 /**

+ 0 - 12
src/core/tcp_read.c

@@ -1375,12 +1375,8 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
 		struct receive_info* rcv_info, struct tcp_connection* con)
 {
 #ifdef TCP_CLONE_RCVBUF
-#ifdef DYN_BUF
-	char *buf = NULL;
-#else
 	static char *buf = NULL;
 	static unsigned int bsize = 0;
-#endif
 	int blen;
 
 	/* cloning is disabled via parameter */
@@ -1404,13 +1400,6 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
 	if(blen < BUF_SIZE)
 		blen = BUF_SIZE;
 
-#ifdef DYN_BUF
-	buf=pkg_malloc(blen+1);
-	if (buf==0) {
-		PKG_MEM_ERROR;
-		return -1;
-	}
-#else
 	/* allocate buffer when needed
 	 * - no buffer yet
 	 * - 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,
 		}
 		bsize = blen;
 	}
-#endif
 
 	memcpy(buf, tcpbuf, len);
 	buf[len] = '\0';

+ 0 - 11
src/core/udp_server.c

@@ -422,11 +422,7 @@ error:
 int udp_rcv_loop()
 {
 	unsigned len;
-#ifdef DYN_BUF
-	char* buf;
-#else
 	static char buf [BUF_SIZE+1];
-#endif
 	char *tmp;
 	union sockaddr_union* fromaddr;
 	unsigned int fromaddrlen;
@@ -457,13 +453,6 @@ int udp_rcv_loop()
 	if (cfg_child_init()) goto error;
 
 	for(;;){
-#ifdef DYN_BUF
-		buf=pkg_malloc(BUF_SIZE+1);
-		if (buf==0){
-			PKG_MEM_ERROR;
-			goto error;
-		}
-#endif
 		fromaddrlen=sizeof(union sockaddr_union);
 		len=recvfrom(bind_address->socket, buf, BUF_SIZE, 0,
 				(struct sockaddr*)fromaddr, &fromaddrlen);