Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Nov 2015 08:40:16 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r290232 - head/lib/libc/stdio
Message-ID:  <201511010840.tA18eGvb010966@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511010840.tA18eGvb010966>