httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/src apreq.c apreq.h
Date Sat, 10 Jul 2004 14:24:17 GMT
joes        2004/07/10 07:24:17

  Modified:    src      apreq.c apreq.h
  Log:
  Eliminate tail-recursion in apreq_decodev.
  
  Revision  Changes    Path
  1.41      +5 -6      httpd-apreq-2/src/apreq.c
  
  Index: apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- apreq.c	9 Jul 2004 23:00:38 -0000	1.40
  +++ apreq.c	10 Jul 2004 14:24:17 -0000	1.41
  @@ -407,9 +407,11 @@
   
       *bytes_written = 0;
       for (n = 0; n < nelts; ++n) {
  -        apr_size_t slen = v[n].iov_len;
  -        apr_size_t dlen;
  +        apr_size_t slen, dlen;
   
  +    start_decodev:
  +
  +        slen = v[n].iov_len;
           switch (status = url_decode(d,&dlen,v[n].iov_base, &slen)) {
   
           case APR_SUCCESS:
  @@ -428,10 +430,7 @@
               memcpy(d + dlen, v[n].iov_base, v[n].iov_len);
               v[n].iov_len += dlen;
               v[n].iov_base = d;
  -
  -            status = apreq_decodev(d, v + n, nelts - n, &dlen);
  -            *bytes_written += dlen;
  -            return status;
  +            goto start_decodev;
   
           default:
               *bytes_written = dlen;
  
  
  
  1.46      +12 -0     httpd-apreq-2/src/apreq.h
  
  Index: apreq.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.h,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- apreq.h	9 Jul 2004 23:00:38 -0000	1.45
  +++ apreq.h	10 Jul 2004 14:24:17 -0000	1.46
  @@ -241,6 +241,18 @@
   
   APREQ_DECLARE(apr_ssize_t) apreq_decode(char *dest, const char *src, apr_size_t slen);
   
  +
  +/**
  + * Url-decodes an iovec array.
  + * @param dest Location of url-encoded result string. Caller must ensure dest is
  + *             large enough to hold the encoded string and trailing null character.
  + * @param v Array of iovecs that represent the source string
  + * @param nelts Number of iovecs in the array.
  + * @param bytes_written  Resultant length of successfully decoded data.
  + * @return APR_SUCCESS on success, APR_INCOMPLETE if the iovec ends in the
  + * middle of an %XX escape sequence, error otherwise.
  + */
  +
   APREQ_DECLARE(apr_status_t) apreq_decodev(char *d, struct iovec *v, 
                                             int nelts, apr_size_t *bytes_written);
   
  
  
  

Mime
View raw message