ldlex should use streams

Ian Lance Taylor ian@airs.com
Thu Jan 24 10:29:00 GMT 2002


Andreas Jaeger <aj@suse.de> writes:

> @@ -595,7 +595,7 @@
>      {
>        if (yyin)
>  	{
> -	  *result = read (fileno (yyin), (char *) buf, max_size);
> +	  *result = fread ((char *) buf, 1, max_size, yyin);
>  	  if (*result < 0) 
>  	    einfo ("%F%P: read in flex scanner failed\n");
>  	}

If you change read to fread, you have to change the error check.
fread will never return a negative value.  You have to check for a
short count, and use ferror.

Ian



More information about the Binutils mailing list