lkml.org 
[lkml]   [2005]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Really *do* nothing in while loop
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-05-08 13:45    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site