From: Benjamin Kramer Date: Tue, 17 Nov 2009 20:51:40 +0000 (+0000) Subject: fgetln is a BSDism; replace it with more portable code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9933b98399f656653a0876fc39e5b9093efb732;p=clang fgetln is a BSDism; replace it with more portable code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89140 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index 1ef27e6f64..f5ddfa68da 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -212,12 +212,15 @@ static int perform_file_scan(const char *ast_file, const char *source_file) { 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) {