svn commit: r290232 - head/lib/libc/stdio

Andrey A. Chernov ache at FreeBSD.org
Sun Nov 1 08:40:17 UTC 2015


Author: ache
Date: Sun Nov  1 08:40:15 2015
New Revision: 290232
URL: https://svnweb.freebsd.org/changeset/base/290232

Log:
  Microoptimize.

Modified:
  head/lib/libc/stdio/ftell.c

Modified: head/lib/libc/stdio/ftell.c
==============================================================================
--- head/lib/libc/stdio/ftell.c	Sun Nov  1 06:47:05 2015	(r290231)
+++ head/lib/libc/stdio/ftell.c	Sun Nov  1 08:40:15 2015	(r290232)
@@ -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;


More information about the svn-src-all mailing list