httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/network_io/win32 sendrecv.c
Date Fri, 04 Feb 2000 19:22:57 GMT
stoddard    00/02/04 11:22:57

  Modified:    src/lib/apr/network_io/win32 sendrecv.c
  Log:
  Very minor performance tweak. Do not copy header/trailer buffer if there is
  just one.
  
  Revision  Changes    Path
  1.9       +28 -15    apache-2.0/src/lib/apr/network_io/win32/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sendrecv.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- sendrecv.c	2000/02/04 19:05:22	1.8
  +++ sendrecv.c	2000/02/04 19:22:55	1.9
  @@ -183,30 +183,43 @@
       memset(&tfb, '\0', sizeof (tfb));
       if (hdtr && hdtr->numheaders) {
           ptfb = &tfb;
  -        for (i = 0; i < hdtr->numheaders; i++) {
  -            tfb.HeadLength += hdtr->headers[i].iov_len;
  +        if (hdtr->numheaders == 1) {
  +            ptfb->Head = hdtr->headers[0].iov_base;
  +            ptfb->HeadLength = hdtr->headers[0].iov_len;
           }
  +        else {
  +            /* Need to collapse all the header fragments into one buffer */
  +            for (i = 0; i < hdtr->numheaders; i++) {
  +                ptfb->HeadLength += hdtr->headers[i].iov_len;
  +            }
  +            ptfb->Head = ap_palloc(sock->cntxt, ptfb->HeadLength); /* Should this
be a malloc? */
   
  -        tfb.Head = ap_palloc(sock->cntxt, tfb.HeadLength); /* Should this be a malloc?
*/
  -
  -        for (i = 0; i < hdtr->numheaders; i++) {
  -            memcpy((char*)tfb.Head + ptr, hdtr->headers[i].iov_base,
  -                   hdtr->headers[i].iov_len);
  -            ptr += hdtr->headers[i].iov_len;
  +            for (i = 0; i < hdtr->numheaders; i++) {
  +                memcpy((char*)ptfb->Head + ptr, hdtr->headers[i].iov_base,
  +                       hdtr->headers[i].iov_len);
  +                ptr += hdtr->headers[i].iov_len;
  +            }
           }
       }
       if (hdtr && hdtr->numtrailers) {
           ptfb = &tfb;
  -        for (i = 0; i < hdtr->numtrailers; i++) {
  -            tfb.TailLength += hdtr->headers[i].iov_len;
  +        if (hdtr->numtrailers == 1) {
  +            ptfb->Tail = hdtr->trailers[0].iov_base;
  +            ptfb->TailLength = hdtr->trailers[0].iov_len;
           }
  +        else {
  +            /* Need to collapse all the trailer fragments into one buffer */
  +            for (i = 0; i < hdtr->numtrailers; i++) {
  +                ptfb->TailLength += hdtr->headers[i].iov_len;
  +            }
   
  -        tfb.Tail = ap_palloc(sock->cntxt, tfb.TailLength); /* Should this be a malloc?
*/
  +            ptfb->Tail = ap_palloc(sock->cntxt, ptfb->TailLength); /* Should this
be a malloc? */
   
  -        for (i = 0; i < hdtr->numtrailers; i++) {
  -            memcpy((char*)tfb.Tail + ptr, hdtr->trailers[i].iov_base,
  -                   hdtr->trailers[i].iov_len);
  -            ptr += hdtr->trailers[i].iov_len;
  +            for (i = 0; i < hdtr->numtrailers; i++) {
  +                memcpy((char*)ptfb->Tail + ptr, hdtr->trailers[i].iov_base,
  +                       hdtr->trailers[i].iov_len);
  +                ptr += hdtr->trailers[i].iov_len;
  +            }
           }
       }
       /* Initialize the overlapped structure */
  
  
  

Mime
View raw message