core: removed obsolete DYN_BUF define condition
authorDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 21 May 2020 08:03:57 +0000 (10:03 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Thu, 21 May 2020 08:03:57 +0000 (10:03 +0200)
src/core/parser/msg_parser.c
src/core/tcp_read.c
src/core/udp_server.c

index ca0bf78..aff3c0a 100644 (file)
@@ -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 */
 }
 
 /**
index afb1248..8147951 100644 (file)
@@ -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';
index b718895..9234e54 100644 (file)
@@ -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);