Git development
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: jdow <jdow@earthlink.net>
Cc: James Purser <purserj@ksit.dynalias.com>,
	Thomas Glanzmann <sithglan@stud.uni-erlangen.de>,
	LKML <linux-kernel@vger.kernel.org>, GIT <git@vger.kernel.org>
Subject: Re: [PATCH] Really *do* nothing in while loop
Date: Sun, 08 May 2005 15:40:40 +0400	[thread overview]
Message-ID: <427DFAB8.5050000@tls.msk.ru> (raw)
In-Reply-To: <12e801c553c1$c454ea20$1225a8c0@kittycat>

jdow wrote:
> From: "James Purser" <purserj@ksit.dynalias.com>
> 
   while (deflate(&stream, 0) == Z_OK)
-  /* nothing */
+  /* nothing */;
  stream.next_in = buf;
> 
> You guys REALLY do not see the changed semantics here? You are
> changing:
>   while (deflate(&stream, 0) == Z_OK)
>       stream.next_in = buf;
> 
> into
> 
>   while (deflate(&stream, 0) == Z_OK)
>     ;
>   /* Then the data itself.. */
>   stream.next_in = buf;
> 
> I suspect the results of that tiny bit of code would be slightly
> different, especially if "stream.next_in" is volatile, "buf"
> is volatile, or if the assignment to next_in has an effect on
> the "deflate" operation.

As I already said, deflate() in this case does only ONE iteration.
stream.avail_in is NOT changed in the loop (except of the deflate()
itself, where it will be set to 0 - provided out buffer have enouth
room).  So the whole while loop does only ONE iteration, returning
Z_NEED_DATA or something the next one.  So no, the semantics here
(actual semantics) does NOT change.

/mjt

  reply	other threads:[~2005-05-08 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-08  9:34 [PATCH] Really *do* nothing in while loop Thomas Glanzmann
2005-05-08  9:48 ` Michael Tokarev
2005-05-08 11:18   ` Thomas Glanzmann
2005-05-08 11:20   ` James Purser
2005-05-08 11:33     ` jdow
2005-05-08 11:40       ` Michael Tokarev [this message]
2005-05-08 21:08         ` Junio C Hamano
2005-05-08 21:16           ` Daniel Barkalow
2005-05-08 21:35             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=427DFAB8.5050000@tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=git@vger.kernel.org \
    --cc=jdow@earthlink.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=purserj@ksit.dynalias.com \
    --cc=sithglan@stud.uni-erlangen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox