[cfe-commits] r89140 - /cfe/trunk/tools/c-index-test/c-index-test.c

Benjamin Kramer benny.kra at googlemail.com
Tue Nov 17 12:51:40 PST 2009


Author: d0k
Date: Tue Nov 17 14:51:40 2009
New Revision: 89140

URL: http://llvm.org/viewvc/llvm-project?rev=89140&view=rev
Log:
fgetln is a BSDism; replace it with more portable code.

Modified:
    cfe/trunk/tools/c-index-test/c-index-test.c

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=89140&r1=89139&r2=89140&view=diff

==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Tue Nov 17 14:51:40 2009
@@ -212,12 +212,15 @@
   start_col = last_col = 1;
   
   while (!feof(fp)) {
-    size_t len;
-    const char *buf;
-        
-    if ((buf = fgetln(fp, &len)) == NULL)
-      break;
-    
+    size_t len = 0;
+    int c;
+
+    while ((c = fgetc(fp)) != EOF) {
+      len++;
+      if (c == '\n')
+        break;
+    }
+
     ++line;
     
     for (i = 0; i < len ; ++i) {





More information about the cfe-commits mailing list