apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <jwool...@virginia.edu>
Subject Re: [PATCH] apr_file_writev() on UNIX
Date Tue, 05 Oct 2004 01:08:47 GMT
On Mon, 4 Oct 2004, Jean-Jacques Clar wrote:

> If HAS_WRITEV is not defined the current code
> will just push the first vector to the target.

Oooh, that sucks.  Good catch.


> The function should write all the vectors or none.
> I propose the following patch, comments will be

+1, with the following nit:


> +    apr_status_t rv;
> +    int i, bytes = 0;
> +
> +    for (i = 0; i < nvec; i++) {
> +        *nbytes = vec[i].iov_len;

Is there really a point to the above line?  *nbytes will always be
overwritten before returning anyway, so why not just skip this line and
then:

> +        if ((rv = apr_file_write(thefile, vec[i].iov_base, nbytes)) !=
> APR_SUCCESS) {
> +            *nbytes = bytes;
> +            return rv;
> +        }
> +        else {
> +            bytes += *nbytes;

bytes += vec[i].iov_len;

> +        }
> +    }
> +    *nbytes = bytes;
> +
> +    return APR_SUCCESS;

Thoughts?

--Cliff

Mime
View raw message