PERFORCE change 96176 for review

John Birrell jb at FreeBSD.org
Thu Apr 27 00:19:00 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96176

Change 96176 by jb at jb_freebsd2 on 2006/04/27 00:18:54

	Fix the YY_INPUT definition when filling the input buffer from
	a file.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_lex.l#4 edit

Differences ...

==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_lex.l#4 (text) ====

@@ -51,17 +51,9 @@
  */
 #define YY_INPUT(buf,result,max_size) \
 	if (yypcb->pcb_fileptr != NULL) { \
-		int n; \
-		for (n = 0; n < max_size && \
-		    ferror(yypcb->pcb_fileptr) == 0; n++) { \
-			int c = fgetc(yypcb->pcb_fileptr); \
-			if (c == EOF) \
-				break; \
-			buf[n] = c; \
-		} \
-		if (yypcb->pcb_fileptr != NULL && ferror(yypcb->pcb_fileptr)) \
+		if (((result = fread(buf, 1, max_size, yypcb->pcb_fileptr)) == 0) \
+		    && ferror(yypcb->pcb_fileptr)) \
 			longjmp(yypcb->pcb_jmpbuf, EDT_FIO); \
-		return n; \
 	} else { \
 		int n; \
 		for (n = 0; n < max_size && \


More information about the p4-projects mailing list