[Python-checkins] python/dist/src/Modules _hotshot.c,1.23,1.24

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 19 Jul 2002 17:38:03 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv26740

Modified Files:
	_hotshot.c 
Log Message:
unpack_string(): avoid a compiler warning (about a real bug!) by
copying the result of fgetc() into an int variable before testing it
for EOF.


Index: _hotshot.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** _hotshot.c	18 Jul 2002 19:11:44 -0000	1.23
--- _hotshot.c	20 Jul 2002 00:38:01 -0000	1.24
***************
*** 306,309 ****
--- 306,310 ----
      int len;
      int err;
+     int ch;
      char *buf;
      
***************
*** 313,317 ****
      buf = malloc(len);
      for (i=0; i < len; i++) {
!         if ((buf[i] = fgetc(self->logfp)) == EOF) {
              free(buf);
              return ERR_EOF;
--- 314,320 ----
      buf = malloc(len);
      for (i=0; i < len; i++) {
!         ch = fgetc(self->logfp);
! 	buf[i] = ch;
!         if (ch == EOF) {
              free(buf);
              return ERR_EOF;