Skip to content

Commit

Permalink
core: removed obsolete DYN_BUF define condition
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed May 21, 2020
1 parent 2a61e71 commit cbeec44
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
5 changes: 1 addition & 4 deletions src/core/parser/msg_parser.c
Expand Up @@ -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 */
}

/**
Expand Down
12 changes: 0 additions & 12 deletions src/core/tcp_read.c
Expand Up @@ -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 */
Expand All @@ -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
Expand All @@ -1431,7 +1420,6 @@ int receive_tcp_msg(char* tcpbuf, unsigned int len,
}
bsize = blen;
}
#endif

memcpy(buf, tcpbuf, len);
buf[len] = '\0';
Expand Down
11 changes: 0 additions & 11 deletions src/core/udp_server.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cbeec44

Please sign in to comment.