Re: [PATCH] Really *do* nothing in while loop
- From
- Michael Tokarev <mjt@tls.msk.ru>
- Date
- May 8, 2005, 09:48 UTC
- Message-ID
- <427DE086.40307@tls.msk.ru>
- In-Reply-To
- <20050508093440.GA9873@cip.informatik.uni-erlangen.de>
Thomas Glanzmann wrote:
Show 15 quoted lines
> [PATCH] Really *do* nothing in while loop > > Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de> > > --- a/sha1_file.c > +++ b/sha1_file.c > @@ -335,7 +335,7 @@ > stream.next_in = hdr; > stream.avail_in = hdrlen; > while (deflate(&stream, 0) == Z_OK) > - /* nothing */ > + /* nothing */; > > /* Then the data itself.. */ > stream.next_in = buf;
Well, the lack of semicolon is wrong really (and funny).
But is the whole while loop needed at all? deflate() consumes as much input as it can, producing as much output as it can. So without the loop, and without updating the buffer pointers ({next,avail}_{in,out}) it will do just fine without the loop, and will return something != Z_OK on next iteration. If this is to mean to flush output, it should be deflate(&stream, Z_FLUSH) or something.
/mjt
P.S. What's git@vger.kernel.org for ?