On 11/13/14, 5:20 AM, "Stefan Hajnoczi"
<[email protected]<mailto:[email protected]>> wrote:
On Wed, Nov 12, 2014 at 06:48:18PM +0000, Gary Hook wrote:
- return qemu_ftell(f) - last_ftell;
+ delta_ftell = qemu_ftell(f) - last_ftell;
+ return( (delta_ftell > 0) ? 1 : (delta_ftell < 0) ? -1 : 0 );
Good find!
Please don't nest the ternary operator, it is hard to read.
if (delta_ftell < 0) {
return -1;
} else if (delta_ftell > 0) {
return 1;
} else {
return 0;
}
Well, that format wasn¹t my first choice. I¹m still unclear on some of the
style requirements on this project, so I went with terse. Your rewrite
would have been my preference, but I¹m wondering if the syntax checker
will want the parentheses stripped as ³Unnecessary² despite how much they
aid in readability.
This one has caused us no end of pain. It¹s wonderful to eradicate it.