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

Ted Kremenek kremenek at apple.com
Tue Nov 17 12:55:40 PST 2009


Thanks!

On Nov 17, 2009, at 12:51 PM, Benjamin Kramer wrote:

> 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) {
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list