diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2009-11-17 20:51:40 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2009-11-17 20:51:40 +0000 |
commit | a9933b98399f656653a0876fc39e5b9093efb732 (patch) | |
tree | 2eb0986ddbad88944346282769e5e74d8f85b3db /tools/c-index-test/c-index-test.c | |
parent | 1c6da1735ddc5978a2c24394c5112b4868b347f0 (diff) |
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
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 15 |
1 files changed, 9 insertions, 6 deletions
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) { |