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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to