[llvm-commits] [llvm] r105270 - /llvm/trunk/utils/count/count.c
Dan Gohman
gohman at apple.com
Tue Jun 1 07:09:29 PDT 2010
Author: djg
Date: Tue Jun 1 09:09:29 2010
New Revision: 105270
URL: http://llvm.org/viewvc/llvm-project?rev=105270&view=rev
Log:
Fix extra fread after EOF, non-wires-crossed version.
Modified:
llvm/trunk/utils/count/count.c
Modified: llvm/trunk/utils/count/count.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/count/count.c?rev=105270&r1=105269&r2=105270&view=diff
==============================================================================
--- llvm/trunk/utils/count/count.c (original)
+++ llvm/trunk/utils/count/count.c Tue Jun 1 09:09:29 2010
@@ -26,13 +26,15 @@
}
NumLines = 0;
- while ((NumRead = fread(Buffer, 1, sizeof(Buffer), stdin))) {
+ do {
unsigned i;
+ NumRead = fread(Buffer, 1, sizeof(Buffer), stdin);
+
for (i = 0; i != NumRead; ++i)
if (Buffer[i] == '\n')
++NumLines;
- }
+ } while (NumRead == sizeof(Buffer));
if (!feof(stdin)) {
fprintf(stderr, "%s: error reading stdin\n", argv[0]);
More information about the llvm-commits
mailing list