Craig A. Berry <[EMAIL PROTECTED]> writes: > >How do you guarantee you'll never hit the code in PerlIOStdio_unread that >does ungetc inside a loop?
Any ungetc in a loop should check that ungetc worked. However that code is going away... > >I'm going to give the following a try and see what happens: > >--- sv.c;-0 Sat May 18 18:59:19 2002 >+++ sv.c Wed May 22 12:40:17 2002 >@@ -5732,12 +5732,12 @@ > > #if defined(VMS) && defined(PERLIO_IS_STDIO) > /* An ungetc()d char is handled separately from the regular >- * buffer, so we getc() it back out and stuff it in the buffer. >+ * buffer, so we seek to our current position, which is a >+ * noop except for synching up ungetc()'s special 1-byte >+ * pushback buffer with the main stdio buffer. > */ >- i = PerlIO_getc(fp); >+ i = PerlSIO_fseek(fp, (Off_t) 0, SEEK_CUR); > if (i == EOF) return 0; >- *(--((*fp)->_ptr)) = (unsigned char) i; >- (*fp)->_cnt++; > #endif A. That code has been working for years just fine. B. That code is NOT used for -Duseperlio case (PERLIO_IS_STDIO is not true). -- Nick Ing-Simmons http://www.ni-s.u-net.com/
