Module: kamailio Branch: master Commit: cbeec44d4c04c03af39bda85bbd26af6299f2b69 URL: https://github.com/kamailio/kamailio/commit/cbeec44d4c04c03af39bda85bbd26af6...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-05-21T10:03:57+02:00
core: removed obsolete DYN_BUF define condition
---
Modified: src/core/parser/msg_parser.c Modified: src/core/tcp_read.c Modified: src/core/udp_server.c
---
Diff: https://github.com/kamailio/kamailio/commit/cbeec44d4c04c03af39bda85bbd26af6... Patch: https://github.com/kamailio/kamailio/commit/cbeec44d4c04c03af39bda85bbd26af6...
---
diff --git a/src/core/parser/msg_parser.c b/src/core/parser/msg_parser.c index ca0bf789c5..aff3c0a989 100644 --- a/src/core/parser/msg_parser.c +++ b/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 */ }
/** diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index afb1248688..8147951b21 100644 --- a/src/core/tcp_read.c +++ b/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'; diff --git a/src/core/udp_server.c b/src/core/udp_server.c index b718895bd2..9234e54ec1 100644 --- a/src/core/udp_server.c +++ b/src/core/udp_server.c @@ -422,11 +422,7 @@ int udp_init(struct socket_info* sock_info) 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);