Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2006 00:18:59 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96176 for review
Message-ID:  <200604270018.k3R0Ixr6050496@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96176

Change 96176 by jb@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 && \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604270018.k3R0Ixr6050496>