diff options
author | ache <ache@FreeBSD.org> | 2015-11-01 08:40:15 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2015-11-01 08:40:15 +0000 |
commit | 1f0f2b0908cffc460fe37edf8e920e98054511fe (patch) | |
tree | 1206f0dc1fb6a48619c0c47d3e101bd39478ed59 | |
parent | 135d0338a00f20a5f81fbfe0a5ca1d01feeed8d1 (diff) | |
download | FreeBSD-src-1f0f2b0908cffc460fe37edf8e920e98054511fe.zip FreeBSD-src-1f0f2b0908cffc460fe37edf8e920e98054511fe.tar.gz |
Microoptimize.
-rw-r--r-- | lib/libc/stdio/ftell.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c index 61ebee9..152617f 100644 --- a/lib/libc/stdio/ftell.c +++ b/lib/libc/stdio/ftell.c @@ -118,15 +118,14 @@ _ftello(FILE *fp, fpos_t *offset) } if (HASUB(fp)) pos -= fp->_r; /* Can be negative at this point. */ - } else if ((fp->_flags & __SWR) && fp->_p != NULL) { + } else if ((fp->_flags & __SWR) && fp->_p != NULL && + (n = fp->_p - fp->_bf._base) > 0) { /* * Writing. Any buffered characters cause the * position to be greater than that in the * underlying object. */ - n = fp->_p - fp->_bf._base; - if (n > 0 && - ((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP))) { + if ((fp->_flags & __SAPP) || (fp->_flags2 & __S2OAP)) { int serrno = errno; errno = 0; |