From 8a3e4a6db71e690b2b8bf5f3372f4f99a506fdd7 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 8 Nov 2015 13:37:16 +0000 Subject: MFC: r289863,r289931,r290110,r290230,r290231,r290232 r290232: Microoptimize. r290231: Addition to prev. commit. In some edge cases fp->_p can be changed in _sseek(), recalculate. r290230: Don't seek to the end if write buffer is empty (in append modes). PR: 204156 r290110: Add _flags2 per jhb@ suggestion since no room left in _flags. Rewrite O_APPEND flag checking using new __S2OAP flag. r289931: According to POSIX, a write operation shall start at the current size of the stream (if mode had 'a' as the first character). r289863: Since no room left in the _flags, reuse __SALC for O_APPEND. It helps to remove _fcntl() call from _ftello() and optimize seek position calculation in _swrite(). --- include/stdio.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/stdio.h b/include/stdio.h index 6d7916a..d37ea06 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -144,6 +144,7 @@ struct __sFILE { int _fl_count; /* recursive lock count */ int _orientation; /* orientation for fwide() */ __mbstate_t _mbstate; /* multibyte conversion state */ + int _flags2; /* additional flags */ }; #ifndef _STDFILE_DECLARED #define _STDFILE_DECLARED @@ -176,6 +177,8 @@ __END_DECLS #define __SALC 0x4000 /* allocate string space dynamically */ #define __SIGN 0x8000 /* ignore this file in _fwalk */ +#define __S2OAP 0x0001 /* O_APPEND mode is set */ + /* * The following three definitions are for ANSI C, which took them * from System V, which brilliantly took internal interface macros and -- cgit v1.1