aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2015-11-01 08:40:15 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2015-11-01 08:40:15 +0000
commit190d73a7577d61f7e6c00ee14f799324c97024c0 (patch)
tree1206f0dc1fb6a48619c0c47d3e101bd39478ed59 /lib/libc
parent4fe4a788afc89d753f3cca96653279004ed9f829 (diff)
downloadsrc-190d73a7577d61f7e6c00ee14f799324c97024c0.tar.gz
src-190d73a7577d61f7e6c00ee14f799324c97024c0.zip
Microoptimize.
Notes
Notes: svn path=/head/; revision=290232
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/ftell.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c
index 61ebee9ca731..152617f500a0 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;