Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 82762 invoked from network); 5 Oct 2004 01:08:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 5 Oct 2004 01:08:56 -0000 Received: (qmail 80110 invoked by uid 500); 5 Oct 2004 01:08:55 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 79839 invoked by uid 500); 5 Oct 2004 01:08:54 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 79823 invoked by uid 99); 5 Oct 2004 01:08:53 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Date: Mon, 4 Oct 2004 21:08:47 -0400 (EDT) From: Cliff Woolley X-X-Sender: jcw5q@cobra.cs.Virginia.EDU To: Jean-Jacques Clar cc: dev@apr.apache.org Subject: Re: [PATCH] apr_file_writev() on UNIX In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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