summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fseek.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-05-22 15:19:41 +0000
committertjr <tjr@FreeBSD.org>2004-05-22 15:19:41 +0000
commitf5a461b2700c74383086e755fdaed26dc05d848c (patch)
treef6b3a5846b5b7d1a722dc68d0c48e70c32df2e55 /lib/libc/stdio/fseek.c
parent90c5701a2cddfda7b43823be60c581ef7dbd9bf0 (diff)
downloadFreeBSD-src-f5a461b2700c74383086e755fdaed26dc05d848c.zip
FreeBSD-src-f5a461b2700c74383086e755fdaed26dc05d848c.tar.gz
Associate a multibyte conversion state object with each stream. Reset it
to the initial state when a stream is opened or seeked upon. Use the stream's conversion state object instead of a freshly-zeroed one in fgetwc(), fputwc() and ungetwc(). This is only a performance improvement for now, but it would also be required in order to support state-dependent encodings.
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r--lib/libc/stdio/fseek.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index 2838777..b346b5d 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -259,6 +259,7 @@ _fseeko(fp, offset, whence, ltest)
if (HASUB(fp))
FREEUB(fp);
fp->_flags &= ~__SEOF;
+ memset(&fp->_extra->mbstate, 0, sizeof(mbstate_t));
return (0);
}
@@ -303,6 +304,7 @@ dumb:
fp->_r = 0;
/* fp->_w = 0; */ /* unnecessary (I think...) */
fp->_flags &= ~__SEOF;
+ memset(&fp->_extra->mbstate, 0, sizeof(mbstate_t));
if (ltest && ret > LONG_MAX) {
fp->_flags |= __SERR;
errno = EOVERFLOW;
OpenPOWER on IntegriCloud